Getting Data In

How to read a number, then convert to corresponding string and stats table?

bryceweb22
Path Finder

I am trying to extract a module/level ID from my logs and have splunk take that ID and match it to the corresponding name from a csv file and put that into a stats table, please help.

Thanks!

0 Karma
1 Solution

sandeepmakkena
Contributor

YourSearch | rex field=_raw max_match=0 "level ID":\"(?< ID>\d+)\""
| lookup file.csv level ID as ID OUTPUT corresponding_name
| table corresponding_name count

Save your .csv to lookup folder

file.csv

ID corresponding_name
1 A
2 B

This should work.

View solution in original post

0 Karma

sandeepmakkena
Contributor

YourSearch | rex field=_raw max_match=0 "level ID":\"(?< ID>\d+)\""
| lookup file.csv level ID as ID OUTPUT corresponding_name
| table corresponding_name count

Save your .csv to lookup folder

file.csv

ID corresponding_name
1 A
2 B

This should work.

0 Karma

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