Splunk Search

Add comments to search code inside search field

sergeblr
Explorer

Hello everybody, using Splunk 8.1.0 and relaterd to https://docs.splunk.com/Documentation/Splunk/8.1.0/Search/Parsingsearches trying to add comments via ```my_comment``` to search request, but there is error.

Only `comment("my_comment")` works, but it is not what i need...

How to add comment to search request like /* my_comment */ or // my_comment ?

Labels (1)

inventsekar
SplunkTrust
SplunkTrust

Hi @sergeblr may we know your full search query(after hiding hostname, important field-values) and Splunk version please

0 Karma

sergeblr
Explorer

Hi, @inventsekar 

index=apps
host=host*
CASE(ERROR) AND "com.*"
```some comment here```

inventsekar
SplunkTrust
SplunkTrust
index=apps host=host* ERROR  ```some comment here```

are you able to do this search, please check.

0 Karma

sergeblr
Explorer

Безымянный.pngReturns

 

Error in 'SearchParser': You must provide a macro expression.

 

Splunk 8.0.1

inventsekar
SplunkTrust
SplunkTrust

please try this... (this works fine for me)

 

index=_internal CASE(ERROR) /*test*/

 

PS  - karma points appreciated, if this solves your question, please accept it as the solution. thanks.

 

0 Karma

sergeblr
Explorer

For this query /*test*/ parsed as:

'/' symbol, THEN any text (*), THEN 'test' word, THEN again any text (*) and '/' symbol, so this is not parsed as comment :((

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...