<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lookup table with two primary keys in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130802#M35658</link>
    <description>&lt;P&gt;I have five machines providing the C:D service. Some provide service over private circuits and one provides 'public' access.&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;I am generating reports per-machine currently but my long term goal is one report that shows the file movement within the organization.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2013 14:24:25 GMT</pubDate>
    <dc:creator>tyronetv</dc:creator>
    <dc:date>2013-11-06T14:24:25Z</dc:date>
    <item>
      <title>Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130799#M35655</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Because C:D can either receive or send a host can be either PNOD or SNOD.&lt;/P&gt;

&lt;P&gt;The hosts are configured in a file such that:&lt;/P&gt;

&lt;P&gt;nodename Verbose_name&lt;BR /&gt;
ACCT1 "My Client's LA Site"&lt;BR /&gt;
ACCT2 "Internal PHX Site"&lt;BR /&gt;
etc...&lt;/P&gt;

&lt;P&gt;Therefore PNOD can be one of the local machine ID or the remote machine and the same for SNOD.&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Now, my question:  Is it possible to have one lookup file that works for both SNOD and PNOD providing the Verbose name in reports.&lt;/P&gt;

&lt;P&gt;I.e --&lt;/P&gt;

&lt;P&gt;File_1 Received from My Clients LA Site&lt;BR /&gt;
File_2 Sent to My Clients LA Site&lt;/P&gt;

&lt;P&gt;The only difference is in the first one it is PNOD and in the second one it is SNOD.&lt;/P&gt;

&lt;P&gt;Is this easy and I am just over looking it?&lt;/P&gt;

&lt;P&gt;Currently I have two lookup files, exactly the same, except for one is headered "SNOD,Account" and the second is headered "PDOD,SAccount".&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130799#M35655</guid>
      <dc:creator>tyronetv</dc:creator>
      <dc:date>2020-09-28T15:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130800#M35656</link>
      <description>&lt;P&gt;Need a little more clarification. Do you want a single lookup? Are the Accounts different on different nodes? So can NODE1 have 2 Accounts?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130800#M35656</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-06T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130801#M35657</link>
      <description>&lt;P&gt;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 &lt;CODE&gt;'... | lookup nodes.csv Node AS PNOD OUTPUT Account | lookup nodes.csv Node AS SNOD OUTPUT Account AS SAccount | ...'&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130801#M35657</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2013-11-06T14:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130802#M35658</link>
      <description>&lt;P&gt;I have five machines providing the C:D service. Some provide service over private circuits and one provides 'public' access.&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;I am generating reports per-machine currently but my long term goal is one report that shows the file movement within the organization.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130802#M35658</guid>
      <dc:creator>tyronetv</dc:creator>
      <dc:date>2013-11-06T14:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130803#M35659</link>
      <description>&lt;H2&gt;Here's my current search generating a report using my two lookup tables. Luckily C:D logs are all key/value pairs. &lt;/H2&gt;

&lt;P&gt;sourcetype=connectdirect host = HOST_NAME ( RECI=CTRC ) |&lt;BR /&gt;
transaction keepevicted=true PNUM RECI STAR STOP |&lt;BR /&gt;
eval VOLUME=(SBYX/1048576)|&lt;BR /&gt;
search VOLUME&amp;gt;0 |&lt;BR /&gt;
table STAR PNUM SAccount Account SFIL DFIL&lt;/P&gt;

&lt;P&gt;Are you saying I can do :&lt;/P&gt;

&lt;P&gt;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 &lt;/P&gt;

&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:34:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130803#M35659</guid>
      <dc:creator>tyronetv</dc:creator>
      <dc:date>2013-11-06T14:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130804#M35660</link>
      <description>&lt;P&gt;I don't see where you currently use your two lookup tables.&lt;BR /&gt;
The lookup statements should precede the table statement.  lookup ... | table STAR PNUM PNOD Account SNOD SAccount SFIL DFIL&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130804#M35660</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2013-11-06T14:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130805#M35661</link>
      <description>&lt;P&gt;Since the Node Names would be different between your 5 and your 145 clients, you can use a single lookup. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;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&amp;gt;0 | table STAR PNUM PNOD SNOD SFIL DFIL primary_account secondary_account&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130805#M35661</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-06T14:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130806#M35662</link>
      <description>&lt;P&gt;Additionaly, I'm on the Efnet #splunk IRC for direct questions.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 14:48:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130806#M35662</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-06T14:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup table with two primary keys</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130807#M35663</link>
      <description>&lt;P&gt;My original search uses automatic lookups.  Hence SAccount and Account vs PNOD and SNOD&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 15:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-table-with-two-primary-keys/m-p/130807#M35663</guid>
      <dc:creator>tyronetv</dc:creator>
      <dc:date>2013-11-06T15:44:40Z</dc:date>
    </item>
  </channel>
</rss>

