Getting Data In

Search for ip in lookup based on system alias in csv

Trusty
Engager

Helo

I have a search query like this: index=test dscip=192.168.1.1 OR dscip=192.168.1.2 ...

I would like to search this list of ip based on system-alias in my lookup

This is my sample lookup.csv:

system-aliassystem-ip
prod192.168.1.1
dev192.168.2.2
prod

192.168.1.2

 

so what a search query should look like if i want to serach only for prod ip`s ?

 

P

Labels (1)
0 Karma
1 Solution

renjith_nair
Legend

@Trusty 
You can use the lookup to enrich the dataset and then filter based on the value

|makeresults |eval dscip="192.168.1.1 192.168.2.2 192.168.1.2"|makemv dscip| mvexpand dscip
|rename comment as "Above is just data generation"
|lookup lookup.csv system-ip as dscip OUTPUT system-alias as env
|where env = "prod"
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

@Trusty 
You can use the lookup to enrich the dataset and then filter based on the value

|makeresults |eval dscip="192.168.1.1 192.168.2.2 192.168.1.2"|makemv dscip| mvexpand dscip
|rename comment as "Above is just data generation"
|lookup lookup.csv system-ip as dscip OUTPUT system-alias as env
|where env = "prod"
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

Trusty
Engager

It works, I have an IP list based on the specified system name (prod etc). Now how can I associate this list with a search?
So that the list of IPs displayed by this query can be attached to dscip
| search sourcetype="new" DstIP=(list of above ip)

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!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

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

Rounding off the Splunk Dashboard Contest

What does a contest-winning Splunk dashboard look like? In this case, it isn't in a browser tab at all. It ...

A Four Part Event Series: AI + Observability: AI Agents, LLMs, Apps, & Infrastructure

AI + Observability: AI Agents, LLMs, Apps, & Infrastructure The rapid evolution of artificial intelligence ...