Splunk Search

RegEx help

jerinvarghese
Communicator

Hi All,

need help in getting a regex code for the below message.

2020-04-04T15:08:01+00:00 usdaldc <44>  %WAAS-HTTPAO-4-131001: (843570) worker pool isn't healthy
2020-04-04T15:08:01+00:00 usdaldc <43>  %WAAS-HTTPAO-3-131003: (843509) AOSHELL worker thread (28814 0.0) stuck for 650000 msec: start 0x7feedd6aa880(/cisco/lib64/libaoshell.so+0x50880), callback 0x4a6140(/sw/unicorn/bin/http_ao64+0xa6140)

wanted data format: in tabular wrt to the above alarm

Device  Alarm   Message
usdaldc WAAS-HTTPAO worker pool isn't healthy
usdaldc WAAS-HTTPAO AOSHELL worker thread

please help me with the code.

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @jerinvarghese,
Try this:

| rex "\d{4}-\d{2}-\d{2}T\d\d:\d\d:\d\d+\+\d\d:\d\d\s+(?<device>[^ ]+)\s+\<\d+\>\s+\%(?<alarm>\w+-\w+)[^ ]*\s+\(\d+\)\s+(?<message>[^\(]+)((\s+\(\d+\s+)|$)"

that you can test at https://regex101.com/r/zuJBnj/1 .

Ciao.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jerinvarghese,
Try this:

| rex "\d{4}-\d{2}-\d{2}T\d\d:\d\d:\d\d+\+\d\d:\d\d\s+(?<device>[^ ]+)\s+\<\d+\>\s+\%(?<alarm>\w+-\w+)[^ ]*\s+\(\d+\)\s+(?<message>[^\(]+)((\s+\(\d+\s+)|$)"

that you can test at https://regex101.com/r/zuJBnj/1 .

Ciao.
Giuseppe

0 Karma

jerinvarghese
Communicator

I still have a challenge,

Yesterday i noticed some more other alarms comes in with a different pattern in messages. please help me.

COde that you shared me with the logs.....

 | rex field=_raw "\d{4}-\d{2}-\d{2}T\d\d:\d\d:\d\d+\+\d\d:\d\d\s(?<device>[^ ]+)\s<\d\d>\s\s%(?<alarm>\w+-\w+)[^ ]*\s+\(\d+\)\s+(?<Log>[^\(]+)((\s+\(\d+\s+)|)"

2020-04-04T15:08:05+00:00 usdaldc <44>  %WAAS-HTTPAO-4-131001: (143581) worker pool isn't healthy
2020-04-04T15:08:05+00:00 usdaldc <43>  %WAAS-HTTPAO-3-131003: (143528) AOSHELL worker thread

New alarms that I notice and the regex that i created.

    |rex fiel=_raw "\d{4}-\d{2}-\d{2}T\d\d:\d\d:\d\d+\+\d\d:\d\d\s(?<device>[^ ]+)\s<\d\d>\s\s%(?<alarm>\w+-\w+)[^ ]\d-\d{6}:\s(?<message>[^\(]+)"

2020-04-07T11:33:08+00:00 bempp <43>  %WAAS-NODEMGR-3-330105: Keepalive problem: Could not register nodemgr. [7]
2020-04-07T11:11:29+00:00 gbfaw <43>  %WAAS-NODEMGR-3-330105: Keepalive problem: Could not register nodemgr. [7]

How can i merge both regex together.
When am using together.. complete output is gong wrong..

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jerinvarghese,
the new log is different from the previous,
if it could be acceptable for you that the message is all the last part of the log, try tris:

| rex "\d{4}-\d{2}-\d{2}T\d\d:\d\d:\d\d+\+\d\d:\d\d\s(?<device>[^ ]+)\s<\d\d>\s\s%(?<alarm>\w+-\w+)[^ ]*\s+(\(\d+\)\s+)*(?<message>.*)"

that you can test at https://regex101.com/r/k3uJVl/1

Ciao.
Giuseppe

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...