@magnusbaeck Yes you are right, I'm still learning Grok for my log file and is confusing me lot. The patterns I mentioned here are derived from the standard grok patterns and they are available in my patterns folder. And log stash is happy with these.
Please find an excerpt from my log file:
2013-04-05 00:00:02,101 ERROR [scheduler_Worker-6 ] (DataProcessor.java:412 ) RemoteException >
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: 0005: No Data matched the criteria Specified
faultActor:
faultNode:
faultDetail:
{http://www.bea.com/wli/sb/context}fault:<con:errorCode>0005</con:errorCode><con:reason>No Data matched the criteria Specified</con:reason><con:location><con:node>getNumber</con:node> <con:pipeline>getNumber_response</con:pipeline><con:stage>Create Number Response</con:stage> <con:path>response-pipeline</con:path></con:location>
0005: No Data matched the criteria Specified1
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
2013-04-05 00:07:36,535 INFO [TP-Processor8 ] 10.136.59.190 ( WTSDK.java:504 ) WTSDK-
Excerpt from the output generated by logstash
{"@timestamp":"2016-03-07T23:59:47.306Z","message":"2013-04-05 00:00:02,101 ERROR [scheduler_Worker-6 ] (DataProcessor.java:412 ) RemoteException > \nAxisFault\n faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server\n faultSubcode: \n faultString: 0005: No Data matched the criteria Specified\n faultActor: \n faultNode: \n faultDetail: \n\t{http://www.bea.com/wli/sb/context}fault:<con:errorCode>0005</con:errorCode><con:reason>No Data matched the criteria Specified</con:reason><con:location><con:node>GetNumber</con:node><con:pipeline>GetNumber_response</con:pipeline><con:stage>Create Get Trips By Flight Number Response</con:stage><con:path>response-pipeline</con:path></con:location>\n0005: No Data matched the criteria Specified1\n\tat org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)\n\tat org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)\n\tat org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)\n\tat .............
","@version":"1","tags":["multiline","beats_input_codec_multiline_applied"],"beat":{"hostname":"LVRJ8YRJX1","name":"LVRJ8YRJX1"},"count":1,"fields":null,"input_type":"log","offset":3744,"source":"C:\logs\bagassist_x - Copy.log","type":"log","host":"LVRJ8YRJX1"}
Logging pattern
<pattern>%d %-5level [%-28thread] [%-15X{remoteIpAddress}] (%35logger{0}:%-3L\) %message%n</pattern>
logstash.conf - changed my logstash.conf to
input{
beats{
port=>5044
type=>"sky_app_log"
codec=>
multiline{
charset=>"ISO-8859-1"
pattern=>"^%{TIMESTAMP_ISO8601}"
max_lines=>1000
negate=>true
what=>"previous"
}
}
}filter{
mutate{
gsub=>["message","\r",""]
}grok{
patterns_dir=>"./patterns"
match => { message => ["%{TIMESTAMP_ISO8601:timestamp}","%{LOGLEVEL1:loglevel}","%{SKYEXCEPTION_TYPE:exception}"]}
}date{
match=>["timestamp","yyyy-MM-dd HH:mm:ss,SSS"]
remove_field=>["timestamp"]
}
}output{
elasticsearch{
hosts=>"localhost:9200"
}file{
path=>"C:\logs\output9.txt"
}
}
Patterns
LOGLEVEL1 (ALERT|TRACE|DEBUG|[Nn]otice|NOTICE|INFO|WARN?(?:ING)?|ERROR|CRIT?(?:ICAL)?|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)
SKYEXCEPTION_TYPE (?i)\b\w*\QException\E\w*\b
Kibana
I'm xepecting to build some visualizations based on "LOGLEVEL1" and "SKYEXCEPTION_TYPE " for kibana dashboard. But none of these fields are available there.
Please provide me with some pointers to solve this.
Thanks and Regards,
San