Splunk Search

What is the difference in total and Total?

emilynicole73
Engager

index="YOURINDEX" |stats count by domain, id.orig_h | sort -count |stats list(domain) as Domain, list(count) as count sum(count) as Total by id.orig_h |sort -total | head 10

So if I change Total to total, I get different results. Which one would be the correct?

Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

'Total' and 'total' are completely different fields. They cannot be used interchangeably. 'Total' is one result produced by the second stats command. 'total' is null as it not a result from stats. You probably want 'Total'.

---
If this reply helps you, Karma would be appreciated.
0 Karma

dmarling
Builder

You are getting different results because you are applying a sort to a nonexistent field when Total is capitalized and then doing a head 10. The sort is not being applied with a capital "Total" field so you get a different first 10 results with a head 10 than when you sort in descending order with a lower case total. There is nothing wrong or right here, it's just a mistake in your query due to case sensitivity of field names in Splunk.

It would match if you made it this:

index="YOURINDEX" |stats count by domain, id.orig_h | sort -count |stats list(domain) as Domain, list(count) as count sum(count) as Total by id.orig_h |sort -Total | head 10

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma

vnravikumar
Champion

Hi

Field names are always case sensitive, please check.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...