Getting Data In

Parsing a Log File

kshahborr99
New Member

Hi,

I have a file with the below format :

CustID=129857 CusTime=2012-04-04 CusName=John, Doe CustState=NewJersey CustProduct=Cellphone RecName=Peter, Adams RecLoc=Mumbai Corp RecEmail=Peter.adams@yahoo.com

CustID=129857 CusTime=2012-04-04 CusName=John, Doe CustState=NewJersey CustProduct=LanLine RecName=Peter_1, Adams_1 RecLoc=Bangalore Corp RecEmail=Peter_1.adams_1@yahoo.com

CustID=129857 CusTime=2012-04-04 CusName=John, Doe CustState=California CustProduct=Cellphone RecName=Peter, Adams RecLoc=Mumbai Corp RecEmail=Peter.adams@yahoo.com

CustID=129859 CusTime=2012-04-04 CusName=Peter, Doe CustState=NewJersey CustProduct=Cellphone RecName=John, Adams RecLoc=Mumbai Corp RecEmail=Peter.adams@yahoo.com

I want in a graphical / report format for each CustID the CusName and the different RecName he has been dealing with. And if the RecLoc is Mumbai Corp than categorize that as LOCAL else EXTERNAL.

So basically the output should be :

Cust ID CusName Count RecName RecLoc Type
129857 John, Doe 2 Peter, Adams Mumbai Corp LOCAL
129857 John, Doe 1 Peter_1,Adams_1 Bangalore Corp External

129859 Peter, Doe 1 John, Adams Mumbai Corp LOCAL

Pls let me know if this is possible and if you can pls provide a sample code I can try.

Thank you

Tags (1)
0 Karma

Lamar
Splunk Employee
Splunk Employee

Try this:

...<your data search> | eval Type=if(RecLoc="Mumbai Corp", "LOCAL", "External") | stats count as Count by CusName, RecName, RecLoc | fields CustID, CusName, RecName, Count, RecLoc, Type

Let me know if that gets you close.

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 ...