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

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

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

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...