Splunk Search

case sensitive dedup?

blee_i365
Explorer

I have two hosts, one named lower case 'server01', the other named upper case 'SERVER01'. When I do a search such as "foo | dedup host", I only get either server01 or SERVER01, and never both, because apparently dedup is performing case insensitive comparisons. Is there a way to enable case sensitivity?

Thanks much in Advance.

0 Karma
1 Solution

RyanAdams
Engager

Generally (from a networking perspective) you shouldn't have two hosts with the same hostname. However, since you do, you could use regex to determine if the hostname is upper or lowercase. For example:

... | rex field=host "(?P<upperHost>[A-Z0-9]+)"| eval hostCase=if(isnotnull(upperHost), "Upper", "Lower")

Then you could run the dedup command against both the host name and the value of hostCase:

... | dedup host, hostCase

That should leave both hostnames in the results.

PS: I havn't been able to test this so the isnotnull() may not work. Instead you may want to use upperHost="".

View solution in original post

0 Karma

TobiasBoone
Communicator

dedup really needs to have an in-case sensitivity option

RyanAdams
Engager

Generally (from a networking perspective) you shouldn't have two hosts with the same hostname. However, since you do, you could use regex to determine if the hostname is upper or lowercase. For example:

... | rex field=host "(?P<upperHost>[A-Z0-9]+)"| eval hostCase=if(isnotnull(upperHost), "Upper", "Lower")

Then you could run the dedup command against both the host name and the value of hostCase:

... | dedup host, hostCase

That should leave both hostnames in the results.

PS: I havn't been able to test this so the isnotnull() may not work. Instead you may want to use upperHost="".

0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...