Splunk Search

Match a column from a main query with a column in a subquery

ravikumar_sri20
Engager

Hi Experts,

The file ACF2DS_Data.csv contains columns including TIMESTAMP, DS_NAME, and JOBNAME.

I need to match the DS_NAME column from this file with the LKUP_DSN column in DSN_LKUP.csv to obtain the corresponding events from ACF2DS_Data.csv.

The query provided below is not working as expected.

Could you please assist me in resolving the issue with the query?

source="*ACF2DS_Data.csv" index="idxmainframe" earliest=0 latest=now
[search source="*DSN_LKUP.csv" index="idxmainframe" earliest=0 latest=now
| eval LKUP_DSN = "%".LKUP_DSN."%"
| where like(DS_NAME,LKUP_DSN) | table DS_NAME]
| table TIMESTAMP, DS_NAME, JOBNAME

Thanks,
Ravikumar

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

If you need to match the LKUP_DSN field in the subsearch with the DS_NAME field in the main search then LKUP_DSN must renamed to DS_NAME.

source="*ACF2DS_Data.csv" index="idxmainframe" earliest=0 latest=now
[search source="*DSN_LKUP.csv" index="idxmainframe" earliest=0 latest=now
  | rename LKUP_NAME as DS_NAME
  | fields DS_NAME
  | format ]
| table TIMESTAMP, DS_NAME, JOBNAME
---
If this reply helps you, Karma would be appreciated.
0 Karma

ravikumar_sri20
Engager

Hi,

Thanks for your reply!!..I need to do partial match on LKUP_DSN.  Could you please help ?

Thanks,

Ravikumar

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Tell us more about the partial match on LKUP_DSN.  What is it matched against?  What part needs to match?

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

ravikumar_sri20
Engager

The file ACF2DS_Data.csv comprises columns such as TIMESTAMP, DS_NAME, and JOBNAME.

I need to perform a partial match of the LKUP_DSN column from the DSN_LKUP.csv file with the DS_NAME column in the ACF2DS_Data.csv file in order to retrieve the relevant events from ACF2DS_Data.csv.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What constitutes a match between LKUP_DSN and DS_NAME?  How much of DS_NAME is allowed to vary?

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

ravikumar_sri20
Engager

At times, LKUP_DSN will match exactly with DS_NAME. In other instances, LKUP_DSN will contain all the characters of DS_NAME except for the last nine characters.

0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...