Structured log events, #28207 (#28209)

* Expanding the LogMarker to optionally include Map of additional
  properties
* The name of the marker shows up as `tags` in Kibana
* The properties of the LogMarker are included as MDC entries, which
  Logstash encoder automatically understands
* Implemented with classic eventStream logging so that it can be used
  from all places without dependencies to Slf4j
  * also means that it's possible to subscribe to LogEventWithMarker
    to consume these events via the eventStream
* move marker definitions to RemoteLogMarker and ClusterLogMarker
* marker for dead letters
* marker for leader detained/allowed
* marker for member status changed
* markers for shard allocated and started
* test LogMarker with properties in Slf4jLoggerSpec
* doc note of the LogMarker definitions
This commit is contained in:
Patrik Nordwall 2019-12-05 11:36:21 +01:00 committed by GitHub
parent 2f80042cd8
commit 89165badbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 590 additions and 138 deletions

View file

@ -575,6 +575,14 @@ A more advanced (including most Akka added information) example pattern would be
<pattern>%date{ISO8601} level=[%level] marker=[%marker] logger=[%logger] akkaSource=[%X{akkaSource}] sourceActorSystem=[%X{sourceActorSystem}] sourceThread=[%X{sourceThread}] mdc=[ticket-#%X{ticketNumber}: %X{ticketDesc}] - msg=[%msg]%n----%n</pattern>
```
Akka is logging some events with markers. Some of these events also include structured MDC properties.
* The "SECURITY" marker is used for highlighting security related events or incidents.
* Akka Actor is using the markers defined in @apidoc[akka.actor.ActorLogMarker].
* Akka Cluster is using the markers defined in @apidoc[akka.cluster.ClusterLogMarker].
* Akka Remoting is using the markers defined in @apidoc[akka.remote.RemoteLogMarker].
* Akka Cluster Sharding is using the markers defined in @apidoc[akka.cluster.sharding.ShardingLogMarker].
#### Using SLF4J's Markers
It is also possible to use the `org.slf4j.Marker` with the `LoggingAdapter` when using slf4j.

View file

@ -433,6 +433,16 @@ With Logback the timestamp is available with `%X{akkaTimestamp}` specifier withi
</encoder>
```
### Markers
Akka is logging some events with markers. Some of these events also include structured MDC properties.
* The "SECURITY" marker is used for highlighting security related events or incidents.
* Akka Actor is using the markers defined in @apidoc[akka.actor.ActorLogMarker].
* Akka Cluster is using the markers defined in @apidoc[akka.cluster.ClusterLogMarker].
* Akka Remoting is using the markers defined in @apidoc[akka.remote.RemoteLogMarker].
* Akka Cluster Sharding is using the markers defined in @apidoc[akka.cluster.sharding.ShardingLogMarker].
### Logger names
It can be useful to enable debug level or other SLF4J backend configuration for certain modules of Akka when