Splunk Search

Groupby on a name-value pair within a field

skpatnaik
New Member

I have an oracle log file (i am pasting below one record from the log file)
I intend to a table with all possible RETURNCODE[1] values (group by on the name-value pair within the field Message) alongwith their respective count. Please help with a splunk search string

---------- 1 Record From The Log File---------------
8:09:00.000 PM

LogName=Application
SourceName=Oracle.orcl
EventCode=34
EventType=4
Type=Information
ComputerName=Linus-PC
TaskCategory=None
OpCode=None
RecordNumber=2144220
Keywords=Classic
Message=Audit trail: LENGTH: "385" SESSIONID:[6] "101355" ENTRYID:[1] "1" STATEMENT:[1] "1" USERID:[6] "DBSNMP" USERHOST:[18] "WORKGROUP\LINUS-PC" TERMINAL:[8] "LINUS-PC" ACTION:[3] "100" RETURNCODE:[1] "0" COMMENT$TEXT:[114] "Authenticated by: DATABASE; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=fe80::5d33:f1be:ba6:dda3%11)(PORT=20072))" OS$USERID:[19] "NT AUTHORITY\SYSTEM" DBID:[10] "1343606950" PRIV$USED:[1] "5".

Tags (1)
0 Karma

lguinn2
Legend

Try this

yoursearchhere
| rex field=Message "RETURNCODE:\[1\]\s\"(?<return_code>.*?)\""
| stats count by return_code

I don't know what search you need for the initial data retrieval, but source=*thefilename.ext" might work.

kristian_kolb
Ultra Champion

That's a Windows Event Log, so source=WinEventLog:Application SourceName=oracle.orcl would probably work better.

0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...