Dashboards & Visualizations

How to Join Alert lookup file with a mapping file depending on pattern search?

jinishshah
Explorer

Hello,

I have a alert dump data Horizon.csv having important columns like below:

Alert   GRN   Type ....

PNC/hz-hfp-l-abc[MAXRUN]      PNC/hz-hfp-l-abc   Autosys

Filesystem[ivp1234.xy.com] [91>90]   ivp1234.xy.com   Application

Filesystem[ivp1244.xy.com] [91>90]   ivp1244.xy.com   Application

p.start.script.pl is down     Process down   API

which I need to merge with Mapping.csv but on a condition that if Type=Autosys then merge on GRN else merge on Type

details of Mapping.csv

Type   Name   Module    Header

Autosys   hz-hfp-l-abc   HF   EOD Job

Application   <blank>   Eng   Server alerts

API   <blank>   LF   Service alerts   

I need output as 

Alert   GRN   Type   Module   Header

PNC/hz-hfp-l-abc[MAXRUN]      PNC/hz-hfp-l-abc   Autosys   HF   EOD Job

Filesystem[ivp1234.xy.com] [91>90]   ivp1234.xy.com   Application   Eng   Server alerts

Filesystem[ivp1244.xy.com] [91>90]   ivp1244.xy.com   Application   Eng   Server alerts

p.start.script.pl is down     Process down   API   LF Service alerts

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| inputlookup Horizon.csv
| eval Name=if(Type="Autosys",GRN,"all")
| lookup Mapping.csv Type Name

View solution in original post

0 Karma

jinishshah
Explorer

Thanks for your quick reply @ITWhisperer . Merging for Type=Autosys is working fine but not for others. I am getting blank output in others. What if I change <blank> in Mapping.csv to "all". What will be the query then ?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| inputlookup Horizon.csv
| eval Name=if(Type="Autosys",GRN,"all")
| lookup Mapping.csv Type Name
0 Karma

jinishshah
Explorer

Hey @ITWhisperer , it worked for Module column but not working as expected for Header column. Picking up wrong value

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

In what way is it wrong? What are you getting? What are you expecting?

0 Karma

jinishshah
Explorer

Sorry My Bad.....Its works Superbly !!! Thanks for your quick answer !!! Really appreciated !!

ITWhisperer
SplunkTrust
SplunkTrust

Assuming <blank> fields are blank string and not null, try something like this

| inputlookup Horizon.csv
| eval Name=if(Type="Autosys",GRN,"")
| lookup Mapping.csv Type Name
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...