Splunk Search

Lookup Table Question

genesiusj
Builder

Hello,
This probably a stu*** question, but I am not able to find a clear answer.

My code to generate the lookup table works.
Here are the contents of my lookup table.
Input field acct Ex: user1
Output fields aid and adr Exs: 1111 and 10.10.10.10

Input field is selected from a drop down in dashboard panel.

Need to search for events containing any combination of acct, aid and/or adr.

My code results in the same events containing all 3 of these fields.
Here is my code.

index="linuxevents" AND host=ru.us AND source="/var/log/audit/audit.log" AND earliest="09/23/2019:14:28:00" AND latest="09/23/2019:14:30:00"
`comment("    AND (acct="user1" OR auid=aid OR addr=adr) ")`
| lookup myAAAlookup.csv acct
| where (acct="user1") OR (auid=aid) OR (addr=adr)
| table _time, event_id, host, acct, auid, aid, addr, adr, _raw

Note: If I comment out the where command and uncomment the matching terms AND, the same events are generated containing ALL 3 fields.

Isn't there a simple way to do this?

Thanks in advance and God bless,
Genesius

0 Karma

diogofgm
SplunkTrust
SplunkTrust

Use this:

| where (acct="user1") AND ( (auid=aid) OR (addr=adr) )

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi genesiusj,
let me understand:
you have a table where there are three fields the first is the key and the other two are the ones to use in search, then you wanto to search for the key and one o the other fields, is it correct?

If this is your need, try something like this:

index="linuxevents" AND host=ru.us AND source="/var/log/audit/audit.log" AND earliest="09/23/2019:14:28:00" AND latest="09/23/2019:14:30:00"
`comment("    AND (acct="user1" OR auid=aid OR addr=adr) ")`
| lookup myAAAlookup.csv acct OUTPUT aid adr
| search (acct="user1") AND (auid=aid) OR (addr=adr)
| table _time event_id host acct auid aid addr adr _raw

Bye.
Giuseppe

genesiusj
Builder

@gcusello
Thanks. "Nor results found."

I need to use OR OR for the 3 fields, not AND OR.
Tried this
| search (acct="onsjaro") OR (auid=aid) OR (addr=adr)
The same 18 events.

Thanks and God bless,
Genesius

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!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...