Getting Data In

reciprocal entries in next row

dxw350
Path Finder

I am using lookup commands for data in a csv file and trying to map src_ip to the HOST and the SERVER in different rows. As an example
MY ISSUE: There are always entries for both Host and Server, but if the Server entry is not listed as a separate row in the HOST column I need to add it as a reciprocal row. Is there a way to do that with |lookup HOST as src_ip OUTPUT src_ip dest_zone SERVER |lookup SERVER as src_ip OUTPUT src_ip dest_zone SERVER
Example:
HOST SERVER
192.168..1.1 192.168.2.10
192.168.2.10 192.168.1.1 This pair is good

192.168.1.3 192.168.2.11
Missing reciprocal This row needs the reverse

Tags (1)
0 Karma
1 Solution

DalJeanis
Legend

I wouldn't spend a minute thinking about this...

| inputlookup SERVER 
| appendpipe [ | eval hold=HOST | eval HOST=SERVER | eval SERVER=hold | fields - hold] 
| dedup HOST SERVER
| outputlookup append=f SERVER 

View solution in original post

dxw350
Path Finder

hi,

I tried your appendpipe solution and it didn't work. I only have one inputlookup csv called "data_file.csv". How can the following be corrected to work?

index=firewall_juniper sourcetype="juniper:junos:firewall" |dedup src_ip dest_ip | lookup data_file HOST_IP as src_ip output APPLICATION_SERVICE SERVER_IP |search APPLICATION_SERVICE=$param_app$ | inputlookup data_file| appendpipe [ | eval hold=HOST_IP | eval HOST_IP=SERVER_IP | eval SERVER_IP=hold | fields-hold] | dedup HOST_IP SERVER_IP | outputlookup append=f PARITY_SERVER_IP |search APPLICATION_SERVICE=$param_app$ |table src_ip src dest_ip HOSTNAME SERVER_IP

0 Karma

DalJeanis
Legend

I wouldn't spend a minute thinking about this...

| inputlookup SERVER 
| appendpipe [ | eval hold=HOST | eval HOST=SERVER | eval SERVER=hold | fields - hold] 
| dedup HOST SERVER
| outputlookup append=f SERVER 

dxw350
Path Finder

Thanks for the reply. It will be separate rows as entries

0 Karma

somesoni2
Revered Legend

Is your query like this? (there might be a type in first lookup)

your base search giving field src_ip |lookup HOST as src_ip OUTPUT src_ip dest_zone HOST |lookup SERVER as src_ip OUTPUT src_ip dest_zone SERVER

The example output, is it single rows or two rows?

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...