Splunk Search

Problems with extracting fields

SplunkUser5888
Path Finder

Hey guys,

I'm trying to use regular expressions but can't get my head around it. I'm receiving lines such as:

u'C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_txt\\Virus': ('FOUND', 'Eicar-Test-Signature')

u'C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_zip_pass\\Virus.zip': ('FOUND', 'Heuristics.Encrypted.Zip')

u'C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_txt\\Virus': ('FOUND', 'Eicar-Test-Signature') 

u'C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\pyclamd.pyc': ('FOUND', 'Eicar-Test-Signature-1') 

u'C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_zip_pass\\Virus.zip': ('FOUND', 'Heuristics.Encrypted.Zip')

and would like to extract the destination and the ('FOUND' 'VIRUS_NAME') fields separately to create an app. Any help would be greatly appreciated.

Tags (1)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi SplunkUser5888,

somehting like this should get you started:

YourBaseSearchHere | rex field="_raw" "'(?<myDest>.+)'\:\s\('(?<myFound>.+)'\,\s'(?<myVirus>.+)'" | table myDest, myFound, myVirus

this will create a table of three fields for you:

  • myDest=C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_zip_pass\\Virus.zip
  • myFound=FOUND
  • myVirus=Eicar-Test-Signature-1

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi SplunkUser5888,

somehting like this should get you started:

YourBaseSearchHere | rex field="_raw" "'(?<myDest>.+)'\:\s\('(?<myFound>.+)'\,\s'(?<myVirus>.+)'" | table myDest, myFound, myVirus

this will create a table of three fields for you:

  • myDest=C:\\Users\\User\\Downloads\\pyClamd-0.3.4\\SplunkClam\\Virus_zip_pass\\Virus.zip
  • myFound=FOUND
  • myVirus=Eicar-Test-Signature-1

cheers, MuS

MuS
SplunkTrust
SplunkTrust

thx and you're welcome

SplunkUser5888
Path Finder

your answer works miles better than my tweak, I've marked this as answered, thank you

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...