Splunk Search

How to populate multiple fields from lookup csv into search results

tkiermaier_shel
New Member

Hi,
I am needing to pull multiple fields from a lookup CSV into the results from a proxy search

Primary search is:

index=PROXY domain=example.com
| transaction user maxspan=1m
| stats count by user

This gives me
user - count
SURNAME, FIRSTNAME - X(count)

Next I have a lookup CSV containing an AD dump that I want to enrich the first search, *note the Nickname field follows the same format as the user field from the proxy results

| fields user, Branch, Group, count
| lookup AD_all_users.csv Nickname as user, Dep_Branch as Branch, Dep_Group as Group

however when I run these searches together we get

index=PROXY domain=example.com
| transaction user maxspan=1m
| stats count by user
| fields user, Branch, Group, count
| lookup AD_all_users.csv Nickname as user, Dep_Branch as Branch, Dep_Group as Group

User - Branch - Group - count
SURNAME,FIRSTNAME - NULL - NULL - X(count)

anyone able to advise me of wat I have wrong?

PS the lookup CSV has about 30 columns and I only need the 3

0 Karma

richgalloway
SplunkTrust
SplunkTrust

As it often happens, the stats command is the culprit. stats returns only those fields used in the command, which in this example is only 'count' and 'user', so there is no 'Branch' or 'Group' field for later commands to use.

Try stats count, values(*) as * by user or eventstats count by user (which does not have the same side-effect as stats).

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

tkiermaier_shel
New Member

@richgalloway 

so now that I have had a chance to get back to this issue I am not sure what I am doing wrong.

I have tried using eventstats and the values arguments but I still have had no success

0 Karma

richgalloway
SplunkTrust
SplunkTrust
Run your query one statement (pipe) at a time, making sure you get the expected results before adding the next statement. You should soon see which statement is causing the problem.
---
If this reply helps you, Karma would be appreciated.
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...