Getting Data In

How to add a column/field based on csv table

AllenZhang
Explorer

I have a search like:
sourcetype="AAA"|table _time userid, and I have a table like userid, username,
how to make the result as .....|table _time userid username.

Tags (2)
0 Karma
1 Solution

pradeepkumarg
Influencer

upload your csv as a lookup table. Once you create a definition for your lookup, you can achieve with the below search

sourcetype="AAA" | lookup your_csv_definition_name userid output username | table _time userid username

View solution in original post

0 Karma

AllenZhang
Explorer

I was going to accept both answers, but the system only allows one. Thanks to both of you!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Something like this should get you started.

sourcetype="AAA" | lookup file.csv userid OUTPUT username | table _time userid username

If you create an automatic lookup you can omit the lookup command from the search.

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

pradeepkumarg
Influencer

upload your csv as a lookup table. Once you create a definition for your lookup, you can achieve with the below search

sourcetype="AAA" | lookup your_csv_definition_name userid output username | table _time userid username
0 Karma

AllenZhang
Explorer

Thanks for quick answer. I am still struggling how to upload the csv file from my computer to splunk, to make it available to the lookups. Do I need to save it to some certain folder, anything like "import" I need to do?

0 Karma

pradeepkumarg
Influencer

go to settings -> lookups >lookup table files -> new

0 Karma
Get Updates on the Splunk Community!

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...

AppDynamics is now part of Splunk Ideas

Hello Splunkers, We have exciting news for you! AppDynamics has been added to the Splunk Ideas Portal. Which ...

Advanced Splunk Data Management Strategies

Join us on Wednesday, May 14, 2025, at 11 AM PDT / 2 PM EDT for an exclusive Tech Talk that delves into ...