Splunk Search

can I give a description to an extracted field?

rileyken
Explorer

I have a GUID field in my logs, and the guid is unique for a specific location. I wanted to query for all events that happen at a specific location so I have to look up the guid value for the location and then search for the guid. Is it possible to use the friendly name for the location to search by instead?

Tags (1)
0 Karma
1 Solution

jacobpevans
Motivator

Greetings Riley,

  1. Settings > Lookups > "Add New" next to "Lookup table files"
  2. Create a CSV similar to the one below. Upload it with name "GUIDs.csv"
  3. Run the search below in the same app that the csv was uploaded in.

GUIDs.csv

GUID,Description
 1,Location 1
 2,Location 2
 3,Location 3
 4,Location 4
 5,Location 5
 6,Location 6
 7,Location 7
 8,Location 8
 9,Location 9
 10,Location 10

Query

| makeresults count=10
| eval   GUID=random()%10
| lookup GUIDs.csv GUID as GUID
| search Description IN ("Location 1", "Location 2", "Location 3")

If anyone in the future finds this post useful, please refer to this link https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup

Cheers,
Jacob

If you feel this response answered your question, please do not forget to mark it as such. If it did not, but you do have the answer, feel free to answer your own post and accept that as the answer.

View solution in original post

rileyken
Explorer

Thanks, worked like a champ!

0 Karma

jacobpevans
Motivator

You're welcome!

Cheers,
Jacob

If you feel this response answered your question, please do not forget to mark it as such. If it did not, but you do have the answer, feel free to answer your own post and accept that as the answer.
0 Karma

jacobpevans
Motivator

Greetings Riley,

  1. Settings > Lookups > "Add New" next to "Lookup table files"
  2. Create a CSV similar to the one below. Upload it with name "GUIDs.csv"
  3. Run the search below in the same app that the csv was uploaded in.

GUIDs.csv

GUID,Description
 1,Location 1
 2,Location 2
 3,Location 3
 4,Location 4
 5,Location 5
 6,Location 6
 7,Location 7
 8,Location 8
 9,Location 9
 10,Location 10

Query

| makeresults count=10
| eval   GUID=random()%10
| lookup GUIDs.csv GUID as GUID
| search Description IN ("Location 1", "Location 2", "Location 3")

If anyone in the future finds this post useful, please refer to this link https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup

Cheers,
Jacob

If you feel this response answered your question, please do not forget to mark it as such. If it did not, but you do have the answer, feel free to answer your own post and accept that as the answer.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...