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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...