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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...