Splunk Search

Why won't this table show new field names?

firstname
Explorer

Based on what I've studied, I should be able to show a new field named item with a search such as the one below:

index=existing_index | eval item = "apple" | stats count by source | table source, item, count

I would expect output similar to the table below.

source item count
a/b/123.log apple 5
a/c/915.log apple 6
a/b/574.log apple 1

 

Instead, this happens:

source item count
a/b/123.log   5
a/c/915.log   6
a/b/574.log   1

 

Why did I not get what I expected?

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

The stats command removes all fields not mentioned - try this

index=existing_index | eval subfolder = "apple" | stats values(subfolder) as subfolder count by source | table source, subfolder, count

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

The stats command removes all fields not mentioned - try this

index=existing_index | eval subfolder = "apple" | stats values(subfolder) as subfolder count by source | table source, subfolder, count

 

Get Updates on the Splunk Community!

Index This | What’s a riddle wrapped in an enigma?

September 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

BORE at .conf25

Boss Of Regular Expression (BORE) was an interactive session run again this year at .conf25 by the brilliant ...

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...