Have you tried using the grok constructor web site to craft a grok expression? It's also not clear what the desired result is. Do you want to extract any fields besides the timestamp and the IP address? Do all your messages look like this or are there variations to take into account?
all messages are look like this. I want to extract time field, status(adopted or unadopted), device name, device mac and rf-domain from this message. I tried use to grok. But this message is different than usual messages.
devicename - ap3222-E6D67E
device - ap7622
devicemac - 74-57-F7-E6-D4-7E
likewise I want to get that data.
I created following pattern.
%{CISCOTIMESTAMP:ciscotimestamp} %{IP:serverip} %{SYSLOGPROG}: \bDevice(?'devicename'[^'][^/])[^'](?'device'[^'][^/])(?'devicemac'[^'][^/][^)])
but it gives ,
|program |%DEVICE-6-UNADOPTED|
|devicemac |/74-57-F7-E6-D4-7E|
|ciscotimestamp |Apr·25·05:09:47|
|devicename |('ap3222-E6D67E'|
|serverip |52.78.111.182|
|device |/'ap7622'|
I want to remove /, ', ( from above 3 values (devicename,device and devicemac)
Here is a sample pattern that could be written. This assumes that the pattern remains consistent across the log lines.
Custom Pattern used is as follows: CPAT ([\w-]+)
Here is the complete expression: %{CISCOTIMESTAMP:ciscotimestamp} %{IP:serverip} %{SYSLOGPROG}: Device\(\'%{CPAT:devicename}\'\/\'%{CPAT:device}\'\/%{CPAT:devicemac}
I have used the Grok Debugger included with Kibana to write this pattern.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.