Skip to content

Commit

Permalink
Switch to JSON logging by default (#4590) (#4605)
Browse files Browse the repository at this point in the history
  • Loading branch information
simitt authored Jan 11, 2021
1 parent 9f9a92b commit 1a5cb35
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Elastic APM Server
Copyright 2017-2020 Elasticsearch BV
Copyright 2017-2021 Elasticsearch BV

This product includes software developed by The Apache Software
Foundation (http://www.apache.org/).
Expand Down
5 changes: 2 additions & 3 deletions _meta/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,10 @@ output.elasticsearch:
#interval: 0

# Set to true to log messages in json format.
#logging.json: false
#logging.json: true

# Set to true, to log messages with minimal required Elastic Common Schema (ECS)
# information. Recommended to use in combination with `logging.json=true`
# Defaults to true.
# information. Recommended to use in combination with `logging.json=true`.
#logging.ecs: true

#=============================== HTTP Endpoint ===============================
Expand Down
5 changes: 2 additions & 3 deletions apm-server.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,10 @@ output.elasticsearch:
#interval: 0

# Set to true to log messages in json format.
#logging.json: false
#logging.json: true

# Set to true, to log messages with minimal required Elastic Common Schema (ECS)
# information. Recommended to use in combination with `logging.json=true`
# Defaults to true.
# information. Recommended to use in combination with `logging.json=true`.
#logging.ecs: true

#=============================== HTTP Endpoint ===============================
Expand Down
5 changes: 2 additions & 3 deletions apm-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,10 @@ output.elasticsearch:
#interval: 0

# Set to true to log messages in json format.
#logging.json: false
#logging.json: true

# Set to true, to log messages with minimal required Elastic Common Schema (ECS)
# information. Recommended to use in combination with `logging.json=true`
# Defaults to true.
# information. Recommended to use in combination with `logging.json=true`.
#logging.ecs: true

#=============================== HTTP Endpoint ===============================
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var libbeatConfigOverrides = []cfgfile.ConditionalOverride{{
"metrics": map[string]interface{}{
"enabled": false,
},
"ecs": true,
"ecs": true,
"json": true,
},
}),
}}
Expand Down
2 changes: 2 additions & 0 deletions systemtest/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestExportConfigDefaults(t *testing.T) {
expectedConfig := strings.ReplaceAll(`
logging:
ecs: true
json: true
metrics:
enabled: false
path:
Expand All @@ -71,6 +72,7 @@ func TestExportConfigOverrideDefaults(t *testing.T) {
expectedConfig := strings.ReplaceAll(`
logging:
ecs: true
json: true
metrics:
enabled: true
path:
Expand Down
17 changes: 5 additions & 12 deletions tests/system/config/apm-server.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,14 @@ output.elasticsearch:

############################# Logging #########################################

{% if logging_json or logging_level or logging_ecs_disabled %}
logging:
{% endif %}
{% if logging_json %}
# Set to true to log messages in json format.
json: {{ logging_json }}
{% endif %}

{% if logging_level %}
# Set log level
level: {{ logging_level }}
# Defaults to true.
logging.json: {{ logging_json }}
{% endif %}

{% if logging_ecs_disabled %}
ecs: false
{% if logging_ecs %}
# Defaults to true.
logging.ecs: {{ logging_json }}
{% endif %}

queue.mem.flush.min_events: {{ queue_flush }}
Expand Down
3 changes: 0 additions & 3 deletions tests/system/test_integration_acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def config(self):
cfg = super(AgentConfigurationTest, self).config()
cfg.update({
"kibana_host": self.get_kibana_url(),
"logging_json": "true",
"kibana_enabled": "true",
"acm_cache_expiration": "1s"
})
Expand Down Expand Up @@ -184,7 +183,6 @@ def test_rum_disabled(self):
@integration_test
class AgentConfigurationKibanaDownIntegrationTest(ElasticTest):
config_overrides = {
"logging_json": "true",
"secret_token": "supersecret",
"kibana_enabled": "true",
"kibana_host": "unreachablehost"
Expand Down Expand Up @@ -223,7 +221,6 @@ def test_config_requests(self):
@integration_test
class AgentConfigurationKibanaDisabledIntegrationTest(ElasticTest):
config_overrides = {
"logging_json": "true",
"kibana_enabled": "false",
}

Expand Down
3 changes: 2 additions & 1 deletion tests/system/test_jaeger.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def config(self):
# check that the authorization tag is always removed,
# even if there's no secret token / API Key auth.
"jaeger_grpc_auth_tag": "authorization",
"logging_ecs_disabled": "true",
"logging_ecs": "false",
"logging_json": "false",
})
return cfg

Expand Down

0 comments on commit 1a5cb35

Please sign in to comment.