Splunk Search

cant use "\\" in search using django

bontet99
New Member

I have search like this:

| crawl | eval path=substr(source,51,50) | eval dir=mvindex(split(path,"\"),0)

But i get error Unbalance quotes, so i modify my search like this:

| crawl | eval path=substr(source,51,50) | eval dir=mvindex(split(path,"\\"),0)

Which works fine in the web UI search bar but when i put it on django searchmanager:

{% searchmanager id="listdata"
   search='| crawl  | eval path=substr(source,51,50) | eval dir=mvindex(split(path,"\\"),0) 
%}

it gives an error message

Could not create search

I have tried using "\;" and "\;" it works fine but it gives no results.

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

You may need to "double escape" that. If I may ask, why Django? It should be on its way out, so I'd switch to HTML/Simple XML.

search='| crawl  | eval path=substr(source,51,50) | eval dir=mvindex(split(path,"\\\\"),0)
0 Karma

bontet99
New Member

you need to put semicolon after \, thats not working, thanks for the answer

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...