Skip to content

Commit fc0563f

Browse files
committed
cleanup: log to console by default
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
1 parent 62a7ae6 commit fc0563f

4 files changed

Lines changed: 4 additions & 29 deletions

File tree

build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ docker run \\
1919
--privileged \\
2020
-e STS_API_KEY=none \\
2121
-e STS_PROCESS_AGENT_URL=none \\
22-
-e STS_CLUSTER_AGENT_ENABLED=true \\
23-
-e STS_LOG_TO_CONSOLE=true \\
2422
-v /sys/kernel/debug:/sys/kernel/debug \\
2523
-e HOST_ETC=/host/etc \\
2624
-e HOST_SYS=/host/sys \\

config/config.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ type AgentConfig struct {
6666
SkipKubeletTLSVerify bool
6767
LogFile string
6868
LogLevel string
69-
LogToConsole bool
7069
QueueSize int
7170
Blacklist []*regexp.Regexp
7271
Scrubber *DataScrubber
@@ -187,7 +186,6 @@ func NewDefaultAgentConfig() *AgentConfig {
187186
SkipKubeletTLSVerify: false,
188187
LogFile: defaultLogFilePath,
189188
LogLevel: "info",
190-
LogToConsole: false,
191189
QueueSize: 20,
192190
MaxProcFDs: 200,
193191
MaxPerMessage: maxMessageBatch,
@@ -319,7 +317,8 @@ func NewAgentConfig(agentYaml *YamlAgentConfig) (*AgentConfig, error) {
319317
}
320318

321319
// (Re)configure the logging from our configuration
322-
if err := NewLoggerLevel(cfg.LogLevel, cfg.LogFile, cfg.LogToConsole); err != nil {
320+
// We always log to stdout
321+
if err := NewLoggerLevel(cfg.LogLevel, cfg.LogFile, true); err != nil {
323322
return nil, err
324323
}
325324

@@ -374,17 +373,6 @@ func mergeEnvironmentVariables(c *AgentConfig) *AgentConfig {
374373
c.LogLevel = v
375374
}
376375

377-
// Logging to console
378-
if enabled, err := isAffirmative(os.Getenv("STS_LOGS_STDOUT")); err == nil {
379-
c.LogToConsole = enabled
380-
}
381-
if enabled, err := isAffirmative(os.Getenv("LOG_TO_CONSOLE")); err == nil {
382-
c.LogToConsole = enabled
383-
}
384-
if enabled, err := isAffirmative(os.Getenv("STS_LOG_TO_CONSOLE")); err == nil {
385-
c.LogToConsole = enabled
386-
}
387-
388376
if proxyURL := os.Getenv("HTTPS_PROXY"); proxyURL != "" {
389377
c.HTTPSProxy, err = url.Parse(proxyURL)
390378
if err != nil {

config/yaml_config.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ type YamlAgentConfig struct {
2020
SkipKubeletTLSVerify bool `yaml:"skip_kubelet_tls_verify"`
2121
SkipSSLValidation bool `yaml:"skip_ssl_validation"`
2222
// Used for local debugging (default: false)
23-
LocalRun bool `yaml:"local_run"`
24-
// Whether the process-agent should output logs to console
25-
LogToConsole bool `yaml:"log_to_console"`
26-
LogLevel string `yaml:"log_level"`
23+
LocalRun bool `yaml:"local_run"`
24+
LogLevel string `yaml:"log_level"`
2725
// Incremental publishing: send only changes to server, instead of snapshots
2826
IncrementalPublishingEnabled string `yaml:"incremental_publishing_enabled"`
2927
// Periodically resend all data to allow downstream to recover from any lost data
@@ -203,21 +201,13 @@ func mergeYamlConfig(agentConf *AgentConfig, yc *YamlAgentConfig) (*AgentConfig,
203201
// Debug purpose only
204202
agentConf.LocalRun = yc.LocalRun
205203

206-
if yc.LogToConsole {
207-
agentConf.LogToConsole = true
208-
}
209204
if yc.Process.LogFile != "" {
210205
agentConf.LogFile = yc.Process.LogFile
211206
}
212207
if yc.LogLevel != "" {
213208
agentConf.LogLevel = yc.LogLevel
214209
}
215210

216-
// (Re)configure the logging from our configuration
217-
if err := NewLoggerLevel(agentConf.LogLevel, agentConf.LogFile, agentConf.LogToConsole); err != nil {
218-
return nil, err
219-
}
220-
221211
if yc.StsURL != "" {
222212
defaultURL, err := url.Parse(yc.StsURL)
223213
if err == nil {

docker-compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ services:
103103
HOST_PROC: "/host/proc"
104104
HOST_SYS: "/host/sys"
105105
STS_LOG_LEVEL: "debug"
106-
STS_LOG_TO_CONSOLE: "true"
107106
# healthcheck:
108107
# test: curl --fail -s http://localhost:5000/ || exit 1
109108
# interval: 1m30s

0 commit comments

Comments
 (0)