/// <summary> /// Adds the steps required to configure the hive log collector which aggregates log events received /// from all hive nodes via their [neon-log-host] containers. /// </summary> /// <param name="steps">The configuration step list.</param> private void AddCollectorSteps(ConfigStepList steps) { // Add the steps to create the service. ServiceHelper.AddServiceStartSteps(hive, steps, "neon-log-collector", hive.Definition.Image.LogCollector, new CommandBundle( "docker service create", "--name", "neon-log-collector", "--detach=false", "--mode", "global", "--restart-delay", hive.Definition.Docker.RestartDelay, "--endpoint-mode", "vip", "--network", $"{HiveConst.PrivateNetwork}", "--constraint", $"node.role==manager", "--mount", "type=bind,source=/etc/neon/host-env,destination=/etc/neon/host-env,readonly=true", "--log-driver", "json-file", // Ensure that we don't log to the pipeline to avoid cascading events. ServiceHelper.ImagePlaceholderArg)); // Deploy the [neon-log-collector] traffic manager rule. steps.Add(ActionStep.Create(hive.FirstManager.Name, "setup/neon-log-collection-lbrule", node => { node.Status = "set neon-log-collector traffic manager rule"; // Configure a private hive proxy TCP route so the [neon-log-host] containers // will be able to reach the collectors. var rule = new TrafficTcpRule() { Name = "neon-log-collector", System = true, Log = false // This is important: we don't want to SPAM the log database with its own traffic. }; rule.Frontends.Add( new TrafficTcpFrontend() { ProxyPort = HiveHostPorts.ProxyPrivateTcpLogCollector }); rule.Backends.Add( new TrafficTcpBackend() { Server = "neon-log-collector", Port = NetworkPorts.TDAgentForward }); hive.PrivateTraffic.SetRule(rule); })); }
/// <summary> /// Adds the steps required to configure the Kibana Elasticsearch/logging user interface. /// </summary> /// <param name="steps">The configuration step list.</param> private void AddKibanaSteps(ConfigStepList steps) { // This is super simple: All we need to do is to launch the Kibana // service on the hive managers. ServiceHelper.AddServiceStartSteps(hive, steps, "neon-log-kibana", hive.Definition.Image.Kibana, new CommandBundle( "docker service create", "--name", "neon-log-kibana", "--detach=false", "--mode", "global", "--endpoint-mode", "vip", "--restart-delay", hive.Definition.Docker.RestartDelay, "--network", HiveConst.PrivateNetwork, "--constraint", $"node.role==manager", "--publish", $"{HiveHostPorts.Kibana}:{NetworkPorts.Kibana}", "--mount", "type=bind,source=/etc/neon/host-env,destination=/etc/neon/host-env,readonly=true", "--env", $"ELASTICSEARCH_URL={hive.Definition.LogEsDataUri}", "--log-driver", "json-file", // Ensure that we don't log to the pipeline to avoid cascading events. ServiceHelper.ImagePlaceholderArg)); }