Skip to content

Commit

Permalink
Remove default .log suffix from event.dataset (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
apmmachine authored Oct 19, 2021
1 parent c91dd98 commit 5bfada3
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions docs/tab-widgets/ecs-encoder.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ All you have to do is to use the `co.elastic.logging.logback.EcsEncoder` instead

|`eventDataset`
|String
|`${serviceName}.log`
|`${serviceName}`
|Sets the `event.dataset` field used by the machine learning job of the Logs app to look for anomalies in the log rate.

|`includeMarkers`
Expand Down Expand Up @@ -142,7 +142,7 @@ For example:

|`eventDataset`
|String
|`${serviceName}.log`
|`${serviceName}`
|Sets the `event.dataset` field used by the machine learning job of the Logs app to look for anomalies in the log rate.

|`includeMarkers`
Expand Down Expand Up @@ -229,7 +229,7 @@ For example:

|`eventDataset`
|String
|`${serviceName}.log`
|`${serviceName}`
|Sets the `event.dataset` field used by the machine learning job of the Logs app to look for anomalies in the log rate.

|`stackTraceAsArray`
Expand Down Expand Up @@ -289,7 +289,7 @@ co.elastic.logging.jul.EcsFormatter.serviceNodeName=my-app-cluster-node

|`eventDataset`
|String
|`${serviceName}.log`
|`${serviceName}`
|Sets the `event.dataset` field used by the machine learning job of the Logs app to look for anomalies in the log rate.

|`stackTraceAsArray`
Expand Down Expand Up @@ -349,7 +349,7 @@ class=co.elastic.logging.jboss.logmanager.EcsFormatter, properties={serviceName=

|`eventDataset`
|String
|`${serviceName}.log`
|`${serviceName}`
|Sets the `event.dataset` field used by the machine learning job of the Logs app to look for anomalies in the log rate.

|`stackTraceAsArray`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public static StringBuilder getMessageStringBuilder() {

public static String computeEventDataset(String eventDataset, String serviceName) {
if (eventDataset == null && serviceName != null && !serviceName.isEmpty()) {
return serviceName + ".log";
return serviceName;
}
return eventDataset;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void testMetadata() throws Exception {
assertThat(Instant.parse(getAndValidateLastLogLine().get("@timestamp").textValue())).isCloseTo(Instant.now(), within(1, ChronoUnit.MINUTES));
assertThat(getAndValidateLastLogLine().get("log.level").textValue()).isIn("DEBUG", "FINE");
assertThat(getAndValidateLastLogLine().get("log.logger")).isNotNull();
assertThat(getAndValidateLastLogLine().get("event.dataset").textValue()).isEqualTo("testdataset.log");
assertThat(getAndValidateLastLogLine().get("event.dataset").textValue()).isEqualTo("testdataset");
assertThat(getAndValidateLastLogLine().get("ecs.version").textValue()).isEqualTo("1.2.0");
validateLog(getAndValidateLastLogLine());
}
Expand Down
6 changes: 3 additions & 3 deletions ecs-logging-core/src/test/resources/spec/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
"type": "string",
"required": false,
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-event.html",
"default": "${service.name}.log OR ${service.name}.${appender.name}",
"default": "${service.name} OR ${service.name}.${appender.name}",
"comment": [
"Configurable by users.",
"If the user manually configures the service name,",
"the logging library should set `event.dataset=${service.name}.log` if not explicitly configured otherwise.",
"the logging library should set `event.dataset=${service.name}` if not explicitly configured otherwise.",
"",
"When agents auto-configure the app to use an ECS logger,",
"they should set `event.dataset=${service.name}.${appender.name}` if the appender name is available in the logging library.",
"Otherwise, agents should also set `event.dataset=${service.name}.log`",
"Otherwise, agents should also set `event.dataset=${service.name}`",
"",
"The field helps to filter for different log streams from the same pod, for example and is required for log anomaly detection."
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void setUp() {
formatter.setIncludeOrigin(true);
formatter.setServiceName("test");
formatter.setServiceNodeName("test-node");
formatter.setEventDataset("testdataset.log");
formatter.setEventDataset("testdataset");
formatter.setAdditionalFields("key1=value1,key2=value2");

logger.setLevel(Level.ALL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void setUp() {
formatter.setIncludeOrigin(true);
formatter.setServiceName("test");
formatter.setServiceNodeName("test-node");
formatter.setEventDataset("testdataset.log");
formatter.setEventDataset("testdataset");
formatter.setAdditionalFields("key1=value1,key2=value2");

Handler handler = new InMemoryStreamHandler(out, formatter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void setUp() {
ecsLayout.setServiceName("test");
ecsLayout.setServiceNodeName("test-node");
ecsLayout.setIncludeOrigin(true);
ecsLayout.setEventDataset("testdataset.log");
ecsLayout.setEventDataset("testdataset");
ecsLayout.activateOptions();
ecsLayout.setAdditionalField("key1=value1");
ecsLayout.setAdditionalField("key2=value2");
Expand Down
2 changes: 1 addition & 1 deletion log4j-ecs-layout/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<layout class="co.elastic.logging.log4j.EcsLayout">
<param name="serviceName" value="test"/>
<param name="serviceNodeName" value="test-node"/>
<param name="eventDataset" value="testdataset.log"/>
<param name="eventDataset" value="testdataset"/>
<param name="includeOrigin" value="true"/>
<param name="additionalField" value="key1=value1"/>
<param name="additionalField" value="key2=value2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void setUp() {
.setServiceNodeName("test-node")
.setIncludeMarkers(true)
.setIncludeOrigin(true)
.setEventDataset("testdataset.log")
.setEventDataset("testdataset")
.setAdditionalFields(new KeyValuePair[]{
new KeyValuePair("cluster.uuid", "9fe9134b-20b0-465e-acf9-8cc09ac9053b"),
new KeyValuePair("node.id", "${node.id}"),
Expand Down
2 changes: 1 addition & 1 deletion log4j2-ecs-layout/src/test/resources/log4j2-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Appenders>
<List name="TestAppender">
<EcsLayout serviceName="test" serviceNodeName="test-node" includeMarkers="true" includeOrigin="true"
eventDataset="testdataset.log">
eventDataset="testdataset">
<KeyValuePair key="cluster.uuid" value="9fe9134b-20b0-465e-acf9-8cc09ac9053b"/>
<KeyValuePair key="node.id" value="${node.id}"/>
<KeyValuePair key="empty" value="${empty}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void setUp() {
ecsEncoder.setIncludeOrigin(true);
ecsEncoder.addAdditionalField(new AdditionalField("key1", "value1"));
ecsEncoder.addAdditionalField(new AdditionalField("key2", "value2"));
ecsEncoder.setEventDataset("testdataset.log");
ecsEncoder.setEventDataset("testdataset");
ecsEncoder.start();
appender.setEncoder(ecsEncoder);
appender.start();
Expand Down
2 changes: 1 addition & 1 deletion logback-ecs-encoder/src/test/resources/logback-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<includeMarkers>true</includeMarkers>
<includeOrigin>true</includeOrigin>
<topLevelLabel>top_level</topLevelLabel>
<eventDataset>testdataset.log</eventDataset>
<eventDataset>testdataset</eventDataset>
<additionalField>
<key>key1</key>
<value>value1</value>
Expand Down

0 comments on commit 5bfada3

Please sign in to comment.