Splunk Search

How to manually save a saved search which contains backslashes \ in the query to savedsearches.conf?

pavanae
Builder

I have a splunk query as below which contains a lot of backslashes

 index="ABC" os="Win" FileName="*\\Programs\\Startup\\*" | rex field=FileName "Users\\\(?<username>[^\\\]+)." 

Now, I now that when I tried to add this in savedseacrhes.conf it wont work as expected as in Splunk it breaks the line when it sees backslash. 

 

Any suggestion on how we can add it to saved searches.conf  ?

 

 

 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I've seen lots of backslashes in savedsearches.conf.  The only special use for them is as a line continuation character and that's only when \ is the last character on a line.  Have you tried putting that query in the config file?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...