I have logs files with json format.Here you can find single line of log.
{"instant":{"epochSecond":1628692763,"nanoOfSecond":792000000},"thread":"AWT-EventQueue-0","level":"INFO","loggerName":"com.client.logon.form.Logon","message":"errortype: SECURITY logContent:User Log on user 1","endOfBatch":false,"loggerFqcn":"org.apache.logging.log4j.spi.AbstractLogger","threadId":23,"threadPriority":6,"@timestamp":"2021-08-11T17:39:01.025+0300"}
I need to show fields like thread, level, logger... in elastic server. It work with json filter.I also need to also extract fields "errorType" and "logContent" by manipulating message field ""errortype: SECURITY logContent:User Log on user 1"
Here I use following configuration but it does not work. Each log line does not need to have errorType field. It will be included if level is ERROR. For other levels, I can have logContent inside "message" field. Could you please help me ?
filter{
json{
source => "message"
}
grok {
match => {
"message" => [
"errortype:%{GREEDYDATA:errorType} logContent: %{GREEDYDATA:logContent}"
]
}
}
elastic and logstash versions are 7.3.14