Snippet of the log4j2.properties file being used with ES 7.15.2
status = error
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
######## Server JSON ############################
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.layout.type = ESJsonLayout
appender.rolling.layout.type_name = server
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server-%d{yyyy-MM-dd}.json
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
######Deletion of log files based on createdDate > 3 days DirectWriteRolloverStrategy
appender.rolling.strategy.type = DirectWriteRolloverStrategy
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}_server-*
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileCount
appender.rolling.strategy.action.condition.nested_condition.exceeds = 3
##########
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
rootLogger.appenderRef.rolling.ref = rolling
######## Deprecation JSON #######################
appender.deprecation_rolling.type = RollingFile
appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%d{yyyy-MM-dd}.json
appender.deprecation_rolling.policies.type = Policies
appender.deprecation_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.deprecation_rolling.policies.time.interval = 1
appender.deprecation_rolling.policies.time.modulate = true
appender.deprecation_rolling.strategy.type = DirectWriteRolloverStrategy
appender.deprecation_rolling.strategy.action.type = Delete
appender.deprecation_rolling.strategy.action.basepath = ${sys:es.logs.base_path}
appender.deprecation_rolling.strategy.action.condition.type = IfFileName
appender.deprecation_rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}_deprecation-*
appender.deprecation_rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileCount
appender.deprecation_rolling.strategy.action.condition.nested_condition.exceeds = 3
#################################################
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = warn
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.additivity = false
The same property file when used with ES 7.9 writes deprecation logs when some deprecated feature is being used.
To generate a deprecation log I am creating an index with include_type_name
curl -v -XPUT "localhost:9205/test?include_type_name=true&pretty" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"testtype":{
"properties": {
"field1": {
"type": "text"
}
}
}
}
}
'
As mentioned previously the logFile gets created when the above request is hit in ES 7.9
But with ES 7.15.2, the deprecation logFile is not getting created.
Note: We were using a single node cluster with ES 7.9 and upgraded it to ES 7.15.2 (Rolling Upgrade) and noticed that deprecations logs are not being generated even on using a deprecated feature.