Splunk Search

Lookup table with two primary keys

tyronetv
Communicator

My company uses ConnectDirect (C:D) as a tool for file transfer. Within the connect direct logs the hosts are referred to by the variables PNOD and SNOD where PNOD is the primary node and SNOD is the secondary node.

Because C:D can either receive or send a host can be either PNOD or SNOD.

The hosts are configured in a file such that:

nodename Verbose_name
ACCT1 "My Client's LA Site"
ACCT2 "Internal PHX Site"
etc...

Therefore PNOD can be one of the local machine ID or the remote machine and the same for SNOD.

The assumption is that when the SNOD is the local machine it is inbound traffic. When the PNOD is the local machine it is outbound traffic.

Now, my question: Is it possible to have one lookup file that works for both SNOD and PNOD providing the Verbose name in reports.

I.e --

File_1 Received from My Clients LA Site
File_2 Sent to My Clients LA Site

The only difference is in the first one it is PNOD and in the second one it is SNOD.

Is this easy and I am just over looking it?

Currently I have two lookup files, exactly the same, except for one is headered "SNOD,Account" and the second is headered "PDOD,SAccount".

Tags (1)
0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Since the Node Names would be different between your 5 and your 145 clients, you can use a single lookup.

sourcetype=connectdirect host=HOST_NAME (RECI=CTRC) | eval nodename = coalesce(PNOD,SNOD) | eval type = if(isnotnull(PNOD),"primary","secondary") | lookup nodes.csv Node AS nodename OUTPUT Account | eval {type}_account = Account | transaction keepevicted = true PNUM RECI STAR STOP | eval VOLUME = (SBYX/1048576) | search VOLUME>0 | table STAR PNUM PNOD SNOD SFIL DFIL primary_account secondary_account

this is a little more verbose than you were probably expecting, but it limits the number of reads to the file system and does them before the transaction.

alacercogitatus
SplunkTrust
SplunkTrust

Additionaly, I'm on the Efnet #splunk IRC for direct questions.

0 Karma

tyronetv
Communicator

I have five machines providing the C:D service. Some provide service over private circuits and one provides 'public' access.

So the PNOD can be one of my five machines with the SNOD being one of 145 clients OR PNOD can be someone in a subset of my clients with SNOD being one of my five machines.

I am generating reports per-machine currently but my long term goal is one report that shows the file movement within the organization.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It seems that PNODs and SNODs are just nodes so why not have a single lookup file with "Node" and "Account" fields? Then do your lookups using '... | lookup nodes.csv Node AS PNOD OUTPUT Account | lookup nodes.csv Node AS SNOD OUTPUT Account AS SAccount | ...'.

---
If this reply helps you, Karma would be appreciated.
0 Karma

tyronetv
Communicator

My original search uses automatic lookups. Hence SAccount and Account vs PNOD and SNOD

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't see where you currently use your two lookup tables.
The lookup statements should precede the table statement. lookup ... | table STAR PNUM PNOD Account SNOD SAccount SFIL DFIL

---
If this reply helps you, Karma would be appreciated.
0 Karma

tyronetv
Communicator

Here's my current search generating a report using my two lookup tables. Luckily C:D logs are all key/value pairs.

sourcetype=connectdirect host = HOST_NAME ( RECI=CTRC ) |
transaction keepevicted=true PNUM RECI STAR STOP |
eval VOLUME=(SBYX/1048576)|
search VOLUME>0 |
table STAR PNUM SAccount Account SFIL DFIL

Are you saying I can do :

table STAR PNUM PNOD SNOD SFIL DFIL |lookup nodes.csv Node AS PNOD OUTPUT Account | lookup nodes.csv Node AS SNOD OUTPUT Account AS SAccount

?

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Need a little more clarification. Do you want a single lookup? Are the Accounts different on different nodes? So can NODE1 have 2 Accounts?

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...