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 | Why did the turkey cross the road?

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

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...