Splunk Search

Field extraction stanza help in props.conf?

pavanae
Builder

I have the username filed extraction as follows in the props.conf which extracts the username:-

[sourcetype_X]
EXTRACT-XYZ = username="(?<user>[^+\"]*)"

which extracts the field as follows

x12345@abc-def-ghij-01.com
y67891@klm-def-ghij-01.com
z45787@abc-def-ghij-01.com
ABC-DEF

Now what would be regex stanza to extract the username as follows from the above

x12345
y67891
z45787
ABC-DEF
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Three things to do:

  • include the @ sign in your negated character class
  • remove the tailing double quote
  • replace the * with a + to avoid empty usernames

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Three things to do:

  • include the @ sign in your negated character class
  • remove the tailing double quote
  • replace the * with a + to avoid empty usernames
0 Karma

pavanae
Builder

Thanks @martin_mueller could you provide me the new regex as mentioned above. I might have missing something.

0 Karma

jethrop
Explorer

^(.+?)@ ie everything before the @ sign if that's a pattern

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