Splunk Search

How can I run a search if a field contains the "|" character?

hsu88888
Explorer

Hello,

I need to count the event log line contains AAA|Y|42 but "|" is the pipeline command so that I got error as the following search:
I tried to use " double quote at two sides of the string but no return result.

index=transaction sourcetype=transaction_270 *AAA|Y|42*
| chart count by region_id, partner_id

Splunk will treat Y is the command and got this error:
Search Factory: Unknown search command 'y'.

Please help me with solution.

Thank you very much.

0 Karma
1 Solution

hsu88888
Explorer

No, double quote won't find any event.
This is the right solution that I use and work:
*AAA*Y*42*R

View solution in original post

0 Karma

hsu88888
Explorer

No, double quote won't find any event.
This is the right solution that I use and work:
*AAA*Y*42*R

0 Karma

lfedak_splunk
Splunk Employee
Splunk Employee

Hey @hsu88888, if DalJeanis and Somesoni2 solved your problem, please don't forget to accept the answer! You can upvote posts as well. (Karma points will be awarded for either action.) Happy Splunking!

0 Karma

hsu88888
Explorer

No results found. I already said that in my question

0 Karma

somesoni2
Revered Legend

Just enclose *AAA|Y|42* in double quotes. It'll be then treated as string.

index=transaction sourcetype=transaction_270 "*AAA|Y|42*"
 | chart count by region_id, partner_id
0 Karma

DalJeanis
Legend

This answer is correct and specific for that spot in a search, or for after the command | search. If it's inside a mapped search or a regex, use the rules for wherever it is (usually escape with \).

hsu88888
Explorer

No, double quote won't find any event.
This is the right solution that I use and work:
*AAA*Y*42*R

0 Karma
Get Updates on the Splunk Community!

.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 ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...