<?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 Lookup using an indexed log file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-using-an-indexed-log-file/m-p/303133#M91203</link>
    <description>&lt;P&gt;Hi guys&lt;/P&gt;

&lt;P&gt;I'm not an expert of Splunk.&lt;BR /&gt;
I was wondering if I can use a lookup to reference fields that are stored into another log file (not csv) indexed in Splunk&lt;/P&gt;

&lt;P&gt;Let me explain:&lt;BR /&gt;
I have a log file indexed in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;col1,col2,GCD1,col4,col5
col1,col2,GCD2,col4,col5
col1,col2,GCD3,col4,col5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've another file always indexed in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;graph [
    directed 1
    node [
        id 1
        Node "Node1"
    ]
    node [
        id 2
        Node "Node2"
    ]
    node [
        id 3
        Node "Node3"
    ]
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need a new field when I search for the first file that match the GDCID with the id in the second file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; col1,col2,GCD1,col4,col5,Node1
 col1,col2,GCD2,col4,col5,Node2
 col1,col2,GCD3,col4,col5,Node3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is this possible?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 11:22:59 GMT</pubDate>
    <dc:creator>faustf</dc:creator>
    <dc:date>2017-02-14T11:22:59Z</dc:date>
    <item>
      <title>Lookup using an indexed log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-using-an-indexed-log-file/m-p/303133#M91203</link>
      <description>&lt;P&gt;Hi guys&lt;/P&gt;

&lt;P&gt;I'm not an expert of Splunk.&lt;BR /&gt;
I was wondering if I can use a lookup to reference fields that are stored into another log file (not csv) indexed in Splunk&lt;/P&gt;

&lt;P&gt;Let me explain:&lt;BR /&gt;
I have a log file indexed in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;col1,col2,GCD1,col4,col5
col1,col2,GCD2,col4,col5
col1,col2,GCD3,col4,col5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've another file always indexed in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;graph [
    directed 1
    node [
        id 1
        Node "Node1"
    ]
    node [
        id 2
        Node "Node2"
    ]
    node [
        id 3
        Node "Node3"
    ]
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need a new field when I search for the first file that match the GDCID with the id in the second file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; col1,col2,GCD1,col4,col5,Node1
 col1,col2,GCD2,col4,col5,Node2
 col1,col2,GCD3,col4,col5,Node3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is this possible?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 11:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-using-an-indexed-log-file/m-p/303133#M91203</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-14T11:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup using an indexed log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-using-an-indexed-log-file/m-p/303134#M91204</link>
      <description>&lt;P&gt;The general approach is something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(search identifying data set 1) OR (search identifying data set 2) | stats values(field1) as field1 ... by common_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The general assumption here is to have one event per &lt;CODE&gt;"GCDn"&lt;/CODE&gt; on the left and one event per &lt;CODE&gt;"id n"&lt;/CODE&gt; on the right, the stats stitches them together.&lt;/P&gt;

&lt;P&gt;In your case you may need to do a bit of preprocessing, for example your first data set seems to have values like &lt;CODE&gt;"GCD1"&lt;/CODE&gt; while the second data set appears to have values like &lt;CODE&gt;"id 1"&lt;/CODE&gt; - those field values need to be harmonized before the stats, e.g. like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;() OR () | eval common_field = case(expression identifying data set 1, replace(field_from_data_set_1, "GCD", ""), expression identifying data set 2, replace(field_from_data_set_1, "id ", ""), true(), "unknown id") | stats ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;More background: &lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt;&lt;BR /&gt;
Even more background: &lt;A href="https://wiki.splunk.com/Virtual_.conf"&gt;https://wiki.splunk.com/Virtual_.conf&lt;/A&gt; March 2016 talk "Best practices around grouping and aggregating data from different search results"&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 12:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-using-an-indexed-log-file/m-p/303134#M91204</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-14T12:44:53Z</dc:date>
    </item>
  </channel>
</rss>

