Splunk Search

Need help in parsing events

ansif
Motivator

{{Tag not found: #Friday, November 22, 2019 1:47:00 PM: #XXXXSQL2001: #Medium: #Disk E: has an average queue length of 7.59.: #Disks - Queue Length}}

TimeStamp Field :Friday, November 22, 2019 1:47:00 PM
Host : XXXXSQL2001
Priority :Medium
Message :Disk E: has an average queue length of 7.59.
Alarm_Name:Disks - Queue Length

{{Tag not found: #Friday, November 22, 2019 1:50:38 PM: #XXXX0SQ47: #High: #The file 'R:\MSSQL\MSSQL13.MSSQLSERVER\MSSQL\TempDBData\tempdb_mssql_6.ndf' on database 'tempdb' has an I/O stall time of 57.82 ms/IO averaged over the last 5 samples.: #I/O Stall Time}}

TimeStamp Field :Friday, November 22, 2019 1:50:38 PM
Host : XXXX0SQ47
Priority :High
Message :The file 'R:\MSSQL\MSSQL13.MSSQLSERVER\MSSQL\TempDBData\tempdb_mssql_6.ndf' on database 'tempdb' has an I/O stall time of 57.82 ms/IO averaged over the last 5 samples.
Alarm_Name:I/O Stall Time

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @ansif,
try something like this:

^[^\#]*\#(?<TimeStamp>.*):\s+\#(?<Host>[^:]*):\s+\#(?<Priority>[^:]*):\s+\#(?<Message>.*):\s+\#(?<Alarm_Name>[^\}]*)

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

Ciao and Happy New Year.
Giuseppe

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Give a try

| makeresults 
| eval _raw="{{Tag not found: #Friday, November 22, 2019 1:50:38 PM: #XXXX0SQ47: #High: #The file 'R:\MSSQL\MSSQL13.MSSQLSERVER\MSSQL\TempDBData\tempdb_mssql_6.ndf' on database 'tempdb' has an I/O stall time of 57.82 ms/IO averaged over the last 5 samples.: #I/O Stall Time}}
" 
| eval temp=split(_raw," #") 
| rex field=temp mode=sed "s/(\:$|}})//g" 
| eval "TimeStamp Field" =mvindex(temp,1), Host=mvindex(temp,2),Priority = mvindex(temp,3),Message =mvindex(temp,4),Alarm_Name=mvindex(temp,5) 
| table "TimeStamp Field" Host Priority Message Alarm_Name
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ansif,
try something like this:

^[^\#]*\#(?<TimeStamp>.*):\s+\#(?<Host>[^:]*):\s+\#(?<Priority>[^:]*):\s+\#(?<Message>.*):\s+\#(?<Alarm_Name>[^\}]*)

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

Ciao and Happy New Year.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...