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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...