Splunk Search

How to extract a field in my sample event log?

rileyken
Explorer

here is a small piece of an event in my log:

;GET.SVC.INFO 01-25-17 404<

it starts with a semi-colon and contains the text GET.SVC.INFO a space and then the data formatted as mm-dd-yy and then a space followed by the user id which in this case is 404 followed by an ampsersand lt and an ending semi-colon

I would like to extract the user id at index time as a field name myuserid

thanks

1 Solution

skoelpin
SplunkTrust
SplunkTrust

Assuming your userid is only word characters, this should work.

INFO\s\d+\-\d+\-\d+\s\d+\<(?<myuserid>\w+)

Assuming you need a CO and don't want to bump the service.. You should go to Extract New Fields on the left under Selected Fields, I'd prefer to write my own regular expression and enter in the regex above. Preview the extractions then save

View solution in original post

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Assuming your userid is only word characters, this should work.

INFO\s\d+\-\d+\-\d+\s\d+\<(?<myuserid>\w+)

Assuming you need a CO and don't want to bump the service.. You should go to Extract New Fields on the left under Selected Fields, I'd prefer to write my own regular expression and enter in the regex above. Preview the extractions then save

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