Splunk Search

Match data from items listed in column of csv file

iomega311
Explorer

I have a .csv file with multiple columns. This is an auto-generated .csv file, and I only need to search against one specific column of data that contains host names.

I want to look through all of my data and limit results to only show events that match host names listed in the column of the .csv file.

Example of the csv file:

name,city,address,number,ip address,special hosts,time,country
bob,New York City,123 Main,243524,10.23.2.2,NYC02343,12:35,USA
sue,New York City,456 Main,891217,10.153.12.6,NYC08948,11:36,USA

I don't want or care about any data in this file other than data located in the "special hosts" column.
I want to see windows logon events for these hosts that will display data on the event, so long as it matches a hostname from this .csv in the "special hosts" column.

I have imported the .csv file as a lookup file into splunk. Something like pc_names.csv

Example:
sourcetype=wineventlog:security EventCode=4624 Account_Name!="*$*" | ~~some command that filters the data based on hosts listed in the "special hosts" column in the .csv file~~ | stats count by Account_Name src_hostname src_ip | sort - count

Any ideas on how I can filter based on that column only?

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Assuming you can (or already have) add your csv file as lookup table file. Try like this

sourcetype=wineventlog:security EventCode=4624 Account_Name!="*$*" [| inputlookup your_csv_file.csv | table "special hosts" | rename "special hosts" as host ]
| stats count by Account_Name src_hostname src_ip | sort - count

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Assuming you can (or already have) add your csv file as lookup table file. Try like this

sourcetype=wineventlog:security EventCode=4624 Account_Name!="*$*" [| inputlookup your_csv_file.csv | table "special hosts" | rename "special hosts" as host ]
| stats count by Account_Name src_hostname src_ip | sort - count

iomega311
Explorer

Thank you! I was missing the table part when trying to figure this out.

0 Karma
Get Updates on the Splunk Community!

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 ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...