Splunk Search

Merge near-identical field values

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

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

Explorer

That did the trick! Thank you.

0 Karma

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.

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

Explorer

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

0 Karma