Splunk Search

How to inputlookup match against search field?

7ryota
Explorer

Hi all,

I have a inputlookup file named as leavers.csv which ill be automatically update

this file contain the userID

 

I will need to use the userID and retrieve the user email from index=zscaler

from there i will need to search in the index=exomsgtrace to determine if there is any outbound email from the users listed in the leavers.csv

 

Can i get your help to construct all the requirement into a single query.

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

For others to construct a search, they will need to know which field in index zscaler can be matched with userID - I'll assume the same field name; which field in index zscaler represents user's E-mail - I'll assume the name userEmail, they will also need to know which field in index exomsgtrace represents outbound E-mail - I'll assume something like outgoingEmail, as well as further assume that's a multivalue; as well as how you want the result presented; in addition, what other characteristics are in zscaler and exomsgtrace because different characteristics can require very different search approaches. (These details should be described in the question and not leaving it to volunteers to speculate.)  For simplicity, I'll assume that there's no overlapping fields between the two indices, and userID, outgoingEmail are already extracted, and that you wanted a list of timestamps (_time), senders (sender), and subject (subject) in exomsgtrace when outgointEmail contains E-mail address of a matching userID, all of these fields already available in the index.

Using these assumptions, what I assumed you wanted can be done with something like

index=exomsgtrace OR (index=zscaler 
    [| inputlookup leavers.csv
    | fields userID] ``` assume userID also exists in zscaler ```)
| mvexpand outgoingEmail ``` outgoing Email could be multivalued ```
| eval userEmail = coalesce(userEmail, outgoingEmail) ``` use the same field name ```
| eval _time = if(index == zscaler, null(), _time)
| stats values(_time) as _time values(sender) as sender values(subject) as subject by userEmail

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...