Splunk Search

How do I turn search terms into an extracted field?

saqibhome
Explorer

I would like to turn the seach terms into a extract field at the time of search. For e.g.

"search term 1" OR "search term 2" OR "search term 3" 

Should become one extracted field. Is that possible in Splunk?

0 Karma
1 Solution

saqibhome
Explorer

Figured it out. I am using the eval along with case to create the extracted field from the search terms. e.g.

"search term 1" OR "search term 2" OR "search term 3" | eval search_term=case(like(_raw, "%search term 1%"), "search term 1", like(_raw, "%search term 2%"), "search term 2",  like(_raw, "%search term 3%"), "search term 3")

search_term becomes the extracted field

View solution in original post

0 Karma

saqibhome
Explorer

Figured it out. I am using the eval along with case to create the extracted field from the search terms. e.g.

"search term 1" OR "search term 2" OR "search term 3" | eval search_term=case(like(_raw, "%search term 1%"), "search term 1", like(_raw, "%search term 2%"), "search term 2",  like(_raw, "%search term 3%"), "search term 3")

search_term becomes the extracted field

0 Karma

adonio
Ultra Champion
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

@saqibhome , thanks for posting on Splunk Answers.

But @pyrowood is right. if you want get this answered, you need to add more context to your question. Our community won't be able to help you if they don't have enough information to understand your problem.

Please see our Answers manual to see how to appropriately ask a question on the site.

horsefez
Motivator

What?

You need to give us more information about what you are trying to do. It's not very clear, sorry.

Do you have some sample events on your hands?
Maybe describe what your expected Output should look like.

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...