Getting Data In

How to map my query with inputlookup values?

karthi2809
Builder

I am running script to get ping status of the servers and i onboarded the logs and extract filed as Servers.Now in my inputlookup i have 5 fields (ServerName,ApplicationName,Environment,Alias,IPAdress).So i need to map the query result with inputlookup.

Index=* sourcetype=StatusPing |rex field=_raw "^[^\|\n]*\|\s+(?P<Servers>[^ ]+)" | eval Status=case(Lost=0, "UP", Lost=2, "Warning", Lost=4, "Down")|append [|inputlookup PingStatus.csv|rename Servers as ServerName ]|table Alias,EnvironmentName,ApplicationName,ServerName,IPAddress,Lost,Status

Thanks in Advance

Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use lookup rather than inputlookup.

index=foo sourcetype=StatusPing 
| rex field=_raw "^[^\|\n]*\|\s+(?P<Servers>[^ ]+)" 
| eval Status=case(Lost=0, "UP", Lost=2, "Warning", Lost=4, "Down")
| rename Servers as ServerName
| lookup PingStatus.csv ServerName
| table Alias,EnvironmentName,ApplicationName,ServerName,IPAddress,Lost,Status

Don't use index=* in a production query.  Your Splunk admin will hate you for it.  🙂

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Use lookup rather than inputlookup.

index=foo sourcetype=StatusPing 
| rex field=_raw "^[^\|\n]*\|\s+(?P<Servers>[^ ]+)" 
| eval Status=case(Lost=0, "UP", Lost=2, "Warning", Lost=4, "Down")
| rename Servers as ServerName
| lookup PingStatus.csv ServerName
| table Alias,EnvironmentName,ApplicationName,ServerName,IPAddress,Lost,Status

Don't use index=* in a production query.  Your Splunk admin will hate you for it.  🙂

 

---
If this reply helps you, Karma would be appreciated.

karthi2809
Builder

Thanks

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...