Splunk Search

multi lookup If the fields are different

nnonm111
Path Finder

I'm going to stats through two lookups.
srcip.csv field
src_ip , subnetmaks
dest.csv field
dest_ip,subnetmaks
src_ip , dest_ip , is intended to be used in stats.

ex) index="myindex" |
[ | inputlookup destip.csv]
[ | inputlookup srcip.csv]
stats values(src_ip) AS src_ip by dest_ip

Or is there another way, and if it's different from my index field,
ex)
csv = src_ip myfield = srcip
csv = dest_ip myfield = destip
What should I do if it is?

Labels (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

What problem are you trying to solve with this query?  Does it even produce results?

The inputlookup command reads then entire lookup file, which may not be necessary.  It depends on the goal of the search.  If the goal is to associate an IP address with a subnet mask then the lookup command may be the better choice.  Lookup also lets you associate fields with different names.  See the Search Reference manual for details.

The stats command needs a field common to all events to properly group events by that field.  In the example query, dest_ip is not that field.  Consider using the rename command or the coalesce function to create a field that exists in all events.

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

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...

Share Your Feedback: On Admin Config Service (ACS)!

Help Us Build a Better Admin Config Service Experience (ACS)   We Want Your Feedback on Admin Config Service ...