Splunk Search

Backslash character on subsearch result

joshiro
Communicator

Hi, i am currently working in a search to filter values based on a lookup table and i am having a difficult time with the backslash character ("\").
The search is the following:

 

index=<index> source=source<source> 
access IN ([| inputlookup lookup_accesses.csv 
| mvcombine delim="\",\"" Accesses
| nomv Accesses
| eval Accesses = "\"" + Accesses + "\""
| return $Accesses])
| fields <fields>

 

The problem occurs when the data inside contains the backslash char ("\"), in this case it does not work and returns zero results. Otherwise if the data inside the lookup doesn't contain the backslash char it works fine.
This lookup fields may contain file names and directories and we are trying to make it work for both cases.

Any help will be appreciated.

Regards.
Javier.

Labels (1)
Tags (2)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Did it work if you change access IN to subquery which is format access = xyzzy OR access=zzz ...? Like

index=<index> source=source<source> 
[| inputlookup lookup_accesses.csv 
| mvcombine delim="\",\"" Accesses
| nomv Accesses
| eval Accesses = "\"" + Accesses + "\""
| rename Accesses as access
| format ]
| fields <fields>

r. Ismo 

View solution in original post

isoutamo
SplunkTrust
SplunkTrust

Did it work if you change access IN to subquery which is format access = xyzzy OR access=zzz ...? Like

index=<index> source=source<source> 
[| inputlookup lookup_accesses.csv 
| mvcombine delim="\",\"" Accesses
| nomv Accesses
| eval Accesses = "\"" + Accesses + "\""
| rename Accesses as access
| format ]
| fields <fields>

r. Ismo 

joshiro
Communicator

Hi, i just tried your solution and now it works, needed to make some modification to the SPL and the lookups:

index=<index> source=source<source> 
[| inputlookup lookup_accesses.csv | format ]
| fields <fields>

The fields inside the lookup are:
- filenames.
- directories (with single backslash, no escaping characters).

Thanks for the response.

Regards.

Javier.

Tags (2)
0 Karma
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...