Skip to content

Commit

Permalink
add documentation for logging to ELK using the ECS format
Browse files Browse the repository at this point in the history
  • Loading branch information
troosan committed Sep 22, 2024
1 parent d39662c commit e47cc90
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions docs/src/main/asciidoc/centralized-log-management.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,16 @@ input {
coded => json
}
}
filter {
if ![span][id] and [mdc][spanId] {
mutate { rename => { "[mdc][spanId]" => "[span][id]" } }
}
if ![trace][id] and [mdc][traceId] {
mutate { rename => {"[mdc][traceId]" => "[trace][id]"} }
}
}
output {
stdout {}
elasticsearch {
Expand All @@ -269,7 +279,7 @@ Then configure your application to log in json format instead of GELF
</dependency>
----

and specify the host and port of your Logstash endpoint.
and specify the host and port of your Logstash endpoint. To be ECS compliant, some keys need to be renamed.

Check warning on line 282 in docs/src/main/asciidoc/centralized-log-management.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'. Raw Output: {"message": "[Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'.", "location": {"path": "docs/src/main/asciidoc/centralized-log-management.adoc", "range": {"start": {"line": 282, "column": 89}}}, "severity": "INFO"}

[source, properties]
----
Expand All @@ -279,10 +289,27 @@ quarkus.log.console.json=false
quarkus.log.socket.enable=true
quarkus.log.socket.json=true
quarkus.log.socket.endpoint=localhost:4560
# to have the exception serialized into a single text element
quarkus.log.socket.json.exception-output-type=formatted
#add any additional fields you want
quarkus.log.socket.json.additional-field."ServiceVersion".value=${quarkus.application.version}
# override some keys to be ECS compliant
quarkus.log.socket.json.key-overrides=timestamp=@timestamp,\
logger_name=log.logger,\
level=log.level,\
process_id=process.pid,\
process_name=process.name,\
thread_name=process.thread.name,\
thread_id=process.thread.id,\
sequence=event.sequence,\
host_name=host.hostname,\
stack_trace=error.stack_trace
quarkus.log.socket.json.excluded-keys=loggerClassName
quarkus.log.socket.json.additional-field."service.environment".value=${quarkus.profile}
quarkus.log.socket.json.additional-field."service.name".value=${quarkus.application.name}
quarkus.log.socket.json.additional-field."service.version".value=${quarkus.application.version}
quarkus.log.socket.json.additional-field."data_stream.type".value=logs
quarkus.log.socket.json.additional-field."ecs.version".value=1.12.2
----


Expand Down

0 comments on commit e47cc90

Please sign in to comment.