<?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: Trouble figuring out how to do a lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145867#M40693</link>
    <description>&lt;P&gt;You said there's exactly one value per &lt;CODE&gt;source&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;If so, you can distribute this value using &lt;CODE&gt;eventstats&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eventstats first(profile_name) as profile_name by source | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's assuming the profile name is extracted already. If not, use &lt;CODE&gt;... | rex ",prepare (?\w+)" | ...&lt;/CODE&gt; or whatever regular expression works for your data.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Sep 2014 22:19:50 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-09-30T22:19:50Z</dc:date>
    <item>
      <title>Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145864#M40690</link>
      <description>&lt;P&gt;I have a bunch of log files which as part of the first 4 lines or so sends a handshake in the form of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 20140930093723895211 R 0019 ,prepare ENSAll)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where &lt;CODE&gt;ENSAll&lt;/CODE&gt; is a profile name.  There is only ever one profile per source (each source file is actually per socket).  What I need is to be able to attache this profile name to every event for a given source.  &lt;/P&gt;

&lt;P&gt;I started with a basic join but as we get up to 100k entries per file and the prepare is the first one, this search can take forever.  Also, if the prepare is out of the time window it may not be registered.&lt;/P&gt;

&lt;P&gt;I am at a complete loss how to speed up this query, it feels like it should be able to be indexed somehow since it is once per file, though not the first line necessarily.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I should clarify, the files look more like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...snip...
20140930084819093639 R 0010 (CM,000026
20140930084819561640 R 0016 ,prepare ENSall)
20140930084819561640 R 0010 (CM,000026
20140930084819561640 W 0019 (AK,000019,welcome)
20140930084819811240 W 0027 (AK,000027,starting:resume)
20140930084819811240 R 0014 ,start resume) 
...snip...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I need the profile name for each event following the first prepare.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2014 14:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145864#M40690</guid>
      <dc:creator>agoebel</dc:creator>
      <dc:date>2014-09-30T14:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145865#M40691</link>
      <description>&lt;P&gt;You can extract this value as a field and then setup an automatic lookup. See these&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/Data/Configureindex-timefieldextraction"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.3/Data/Configureindex-timefieldextraction&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.3/Knowledge/Usefieldlookupstoaddinformationtoyourevents&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2014 14:39:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145865#M40691</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-09-30T14:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145866#M40692</link>
      <description>&lt;P&gt;If I'm understanding this correctly I do a regex field extraction at index time, search for it in a report to populate a lookup file, and then do an automatic lookup against that?  I did not think reports ran fast enough (limit of per minute) to be useful.  As soon as that first prepare is seen I need to have it in the rest of the log plus the lookup table would get quite big....good first step though&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2014 14:57:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145866#M40692</guid>
      <dc:creator>agoebel</dc:creator>
      <dc:date>2014-09-30T14:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145867#M40693</link>
      <description>&lt;P&gt;You said there's exactly one value per &lt;CODE&gt;source&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;If so, you can distribute this value using &lt;CODE&gt;eventstats&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eventstats first(profile_name) as profile_name by source | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's assuming the profile name is extracted already. If not, use &lt;CODE&gt;... | rex ",prepare (?\w+)" | ...&lt;/CODE&gt; or whatever regular expression works for your data.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2014 22:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145867#M40693</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-09-30T22:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145868#M40694</link>
      <description>&lt;P&gt;That seemed to do it and was what I am looking for, thanks.  I'm assuming it looks no further back than the time range on the base search which may be a slight problem but that's for another time.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2014 20:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145868#M40694</guid>
      <dc:creator>agoebel</dc:creator>
      <dc:date>2014-10-01T20:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble figuring out how to do a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145869#M40695</link>
      <description>&lt;P&gt;It doesn't look further, no.&lt;/P&gt;

&lt;P&gt;However, you can make it do that. Say you want data from the past seven days, but want to copy over profile values that happen on the eighth day as well. Set your earliest to &lt;CODE&gt;-8d@d&lt;/CODE&gt;, run your search with &lt;CODE&gt;eventstats&lt;/CODE&gt;, and then filter like this: &lt;CODE&gt;... | addinfo | where _time &amp;gt;= relative_time(info_min_time, "+d")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;addinfo&lt;/CODE&gt; adds the search's time range to the events, and the &lt;CODE&gt;where&lt;/CODE&gt; throws out the first day. Do that after the &lt;CODE&gt;eventstats&lt;/CODE&gt; and you will get profile values that happened on that day despite not actually using the events in the end.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2014 20:17:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-figuring-out-how-to-do-a-lookup/m-p/145869#M40695</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-10-01T20:17:39Z</dc:date>
    </item>
  </channel>
</rss>

