Splunk Search

search is returning distinct values

email2vamsi
Explorer

Hi Experts,

|search filed1=Enabled OR "Enabled" OR "Disabled" OR Disabled
The above search is returning four rows.
If i try to sum them based on the status ,still its returning four rows.
|stats sum(dc(servers)) by Status

Status---> dc(servers)
Enabled--> 10
Enabled--> 3
Disabled-> 23
Disabled->6

Thank you.

 

 

0 Karma

email2vamsi
Explorer

@ITWhisperer 

|search filed1=Enabled OR "Enabled" OR "Disabled" OR Disabled

From the above search Enabled returns one row in search,
"Enabled" in double quotes returns second row,
Disabled returns third row and "Disabled" in double quotes returns fourth row.

Field1---> dc(servers)
Enabled--> 10
Enabled--> 3
Disabled-> 23
Disabled->6

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

So, your data actually has double quotes sometimes and not others - therefore these are different which is why you get 4 rows - you will have to manipulate the data in some way to get them to be the same e.g. strip the double quotes from the fields which have them.

0 Karma

PickleRick
SplunkTrust
SplunkTrust

You're getting something wrong.

In a search with

field1=Enabled OR Enabled

the first "subcondition" is not needed because it will match all occurences of "Enabled" within the whole event (ok, there might be a slightly tricky case with calculated/looked up fields but I'm not sure here - would have to test).

Similar thing goes for

Disabled OR "Disabled"

Since "Disabled" is just one word, you're searching twice for the same term.

So there is no mechanism that "returns four rows" here.

You're not showing us the whole picture.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

There doesn't appear to be sufficient information presented to determine what is not working for you. What are the four events returned by the first search?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...