Splunk Search

Is comma ignored during a Splunk search?

filmon6402e
Explorer

Hello Everyone,

I noticed that commas are not necessary when searching as the following would give the same results.


... | stats count, value(product_id) ...
OR
... | stats count value(product_id) ...


Just want to confirm my assumption of commas as a syntax aid is correct.

Thanks.

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

In that case, commas are indeed optional. However, not all commas are optional - here's an example:

index=_internal | timechart avg(bytes) as bytes, values(sourcetype) as sourcetypes | eval bytes = round(bytes, 2)

The first comma is optional, the second is not.

View solution in original post

filmon6402e
Explorer

Thanks a lot.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

In that case, commas are indeed optional. However, not all commas are optional - here's an example:

index=_internal | timechart avg(bytes) as bytes, values(sourcetype) as sourcetypes | eval bytes = round(bytes, 2)

The first comma is optional, the second is not.

filmon6402e
Explorer

Thanks a lot.

0 Karma

somesoni2
Revered Legend

As per my understanding "," is optional for statistical or formatting commands like stats, chart, timechart, table, fields. They do increase the readability of the code.

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...