Elasticsearch support to JSON logging (#36833)
In order to support JSON log format, a custom pattern layout was used and its configuration is enclosed in ESJsonLayout. Users are free to use their own patterns, but if smooth Beats integration is needed, they should use ESJsonLayout. EvilLoggerTests are left intact to make sure user's custom log patterns work fine.
To populate additional fields node.id and cluster.uuid which are not available at start time,
a cluster state update will have to be received and the values passed to log4j pattern converter.
A ClusterStateObserver.Listener is used to receive only one ClusteStateUpdate. Once update is received the nodeId and clusterUUid are set in a static field in a NodeAndClusterIdConverter.
Following fields are expected in JSON log lines: type, tiemstamp, level, component, cluster.name, node.name, node.id, cluster.uuid, message, stacktrace
see ESJsonLayout.java for more details and field descriptions
Docker log4j2 configuration is now almost the same as the one use for ES binary.
The only difference is that docker is using console appenders, whereas ES is using file appenders.
relates: #32850
2019-01-29 01:20:09 -05:00
|
|
|
|
|
|
|
status = error
|
|
|
|
|
|
|
|
# log action execution errors for easier debugging
|
|
|
|
logger.action.name = org.elasticsearch.action
|
|
|
|
logger.action.level = debug
|
|
|
|
|
|
|
|
appender.rolling.type = RollingFile
|
|
|
|
appender.rolling.name = rolling
|
|
|
|
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server.log
|
|
|
|
appender.rolling.layout.type = PatternLayout
|
2020-08-31 07:42:04 -04:00
|
|
|
appender.rolling.layout.pattern =%notEmpty{%node_name} %notEmpty{%node_and_cluster_id} %notEmpty{${sys:es.logs.cluster_name}} %m%n
|
Elasticsearch support to JSON logging (#36833)
In order to support JSON log format, a custom pattern layout was used and its configuration is enclosed in ESJsonLayout. Users are free to use their own patterns, but if smooth Beats integration is needed, they should use ESJsonLayout. EvilLoggerTests are left intact to make sure user's custom log patterns work fine.
To populate additional fields node.id and cluster.uuid which are not available at start time,
a cluster state update will have to be received and the values passed to log4j pattern converter.
A ClusterStateObserver.Listener is used to receive only one ClusteStateUpdate. Once update is received the nodeId and clusterUUid are set in a static field in a NodeAndClusterIdConverter.
Following fields are expected in JSON log lines: type, tiemstamp, level, component, cluster.name, node.name, node.id, cluster.uuid, message, stacktrace
see ESJsonLayout.java for more details and field descriptions
Docker log4j2 configuration is now almost the same as the one use for ES binary.
The only difference is that docker is using console appenders, whereas ES is using file appenders.
relates: #32850
2019-01-29 01:20:09 -05:00
|
|
|
|
|
|
|
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
|
|
|
|
appender.rolling.policies.type = Policies
|
|
|
|
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
|
|
|
|
appender.rolling.policies.time.interval = 1
|
|
|
|
appender.rolling.policies.time.modulate = true
|
|
|
|
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
|
|
|
|
appender.rolling.policies.size.size = 128MB
|
|
|
|
appender.rolling.strategy.type = DefaultRolloverStrategy
|
|
|
|
appender.rolling.strategy.fileIndex = nomax
|
|
|
|
appender.rolling.strategy.action.type = Delete
|
|
|
|
appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path}
|
|
|
|
appender.rolling.strategy.action.condition.type = IfFileName
|
|
|
|
appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
|
|
|
|
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
|
|
|
|
appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
|
|
|
|
|
|
|
|
rootLogger.level = info
|
|
|
|
rootLogger.appenderRef.rolling.ref = rolling
|