Parse json format logagregator logs in logstash

<14>1 2019-05-27T22:29:00.14+0530 [APP/PROC/WEB/0] OUT ,{"timeMillis":1558981507774,"thread":"main","level":"INFO","loggerName":"com.philips.hsdp.log.drain.ref.config.LogDrainerRefApplication","message":"Started LogDrainerRefApplication in 5.633 seconds (JVM running for 12.203)","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogFactory$Log4jLog","contextMap":{"customLogEvent":"CustomEvent","custumfield1":"valueField1","custumfield2":"valueField2","serviceName":"LogDrainerRef","transactionId":"1693b211-3303-49b4-b97c-cc768491f7b4"},"threadId":1,"threadPriority":5}

i want to parse this json format into logstash .. using filters .. please help me solving this issue

i changed the patternLayout to jsonLayout in the xml file ... now for one log msg it is giving me this kind of log msg in cloud foundry

I would break the line up using dissect, then use a json filter.

dissect { mapping => { "message" => "<%{pri}>%{f1} %{ts} [%{f2}] %{f3} ,%{[@metadata][json]}" } }
json { source => "[@metadata][json]" }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.