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!

Your Voice Matters! Help Us Shape the New Splunk Lantern Experience

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Community Content Calendar, October Edition

Welcome to the October edition of our Community Spotlight! The Splunk Community is a treasure trove of ...