Splunk Search

Merge near-identical field values

benefitcos
Explorer

I am new to Splunk but am loving what it can do with it! We use Splunk to track user activity on our webapp. It looks in the logs and extracts my users into the field 'USERNAME'. However, I have one user who uses multiple logins that are almost the same:

  • Sandra.chin ... (17)
  • Sandra Chin ... (10)
  • sandra.chin ... (8)
  • sandra chin ... (4)
  • Sandra chin ... (2)

This is the same person, only spelled with case & punctuation five different ways. How can I merge these field values into one entry (lets say, Sandra Chin) with any/all appropriate totals accounted for? (logins, downloads, etc...) When correct, Sandra's single entry should read like this:

  • Sandra Chin ... (41)

And sort within the overall users count list like this:

  • Bill Johnson ... (88)
  • Sandra Chin ... (41)
  • Mary Thomas ... (24)

Would anyone know how I might accomplish this? Thanks in advance!

0 Karma
1 Solution

benefitcos
Explorer

I later on found this answer:
http://answers.splunk.com/answers/61646/combining-multivalues-together-inside-a-field

However, I'm having trouble combining 'Sandra' and 'sandra' because of the case difference.

View solution in original post

benefitcos
Explorer

That did the trick! Thank you.

0 Karma

lukejadamec
Super Champion

Try setting all of the field values to lower case before you combine them:

| eval USERNAME=lower(USERNAME)

That should eliminate any case problems.

benefitcos
Explorer

I later on found this answer:
http://answers.splunk.com/answers/61646/combining-multivalues-together-inside-a-field

However, I'm having trouble combining 'Sandra' and 'sandra' because of the case difference.

benefitcos
Explorer

per lukejadamec, adding: ... | eval USERNAME=lower(USERNAME) worked nicely.

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