<?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 Need help with Where for _time from lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444319#M168318</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;So inherited a lookup table from former contractor and want to pull and display information based on what was written the last week.  &lt;/P&gt;

&lt;P&gt;On my own built app (with Somesoni2s help) I have this function working great and boss loves it and wants more.  Struggling to get this working on the inherited app.&lt;/P&gt;

&lt;P&gt;Working search (for reference):&lt;BR /&gt;
 &lt;EM&gt;| inputlookup GenAtomicsCheck.csv  | where _time&amp;gt;=relative_time(now(),"-mon@mon") | search CheckStatus="Complete&lt;/EM&gt;" AND CheckType="Monthly" | chart dc(CheckPerformed) AS Completed | eval percentage=Completed/1*100 | chart count by percentage* &lt;/P&gt;

&lt;P&gt;Inherited app (with this search I see data, so I know I can pull from the lookup):&lt;BR /&gt;
*| inputlookup ga_kvstore_lookup | eval  KeyID = _key | table KeyID, AppName, AuditorName, AuditDateTime, ComplianceCheck, AuditUnixTime | sort -AuditUnixTime | fields KeyID, AppName, AuditorName, AuditDateTime, ComplianceCheck *&lt;/P&gt;

&lt;P&gt;I try to add the simply where command and get no results, no error.&lt;/P&gt;

&lt;P&gt;Thoughts?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:29:10 GMT</pubDate>
    <dc:creator>gabarrygowin</dc:creator>
    <dc:date>2020-09-29T20:29:10Z</dc:date>
    <item>
      <title>Need help with Where for _time from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444319#M168318</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;So inherited a lookup table from former contractor and want to pull and display information based on what was written the last week.  &lt;/P&gt;

&lt;P&gt;On my own built app (with Somesoni2s help) I have this function working great and boss loves it and wants more.  Struggling to get this working on the inherited app.&lt;/P&gt;

&lt;P&gt;Working search (for reference):&lt;BR /&gt;
 &lt;EM&gt;| inputlookup GenAtomicsCheck.csv  | where _time&amp;gt;=relative_time(now(),"-mon@mon") | search CheckStatus="Complete&lt;/EM&gt;" AND CheckType="Monthly" | chart dc(CheckPerformed) AS Completed | eval percentage=Completed/1*100 | chart count by percentage* &lt;/P&gt;

&lt;P&gt;Inherited app (with this search I see data, so I know I can pull from the lookup):&lt;BR /&gt;
*| inputlookup ga_kvstore_lookup | eval  KeyID = _key | table KeyID, AppName, AuditorName, AuditDateTime, ComplianceCheck, AuditUnixTime | sort -AuditUnixTime | fields KeyID, AppName, AuditorName, AuditDateTime, ComplianceCheck *&lt;/P&gt;

&lt;P&gt;I try to add the simply where command and get no results, no error.&lt;/P&gt;

&lt;P&gt;Thoughts?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:29:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444319#M168318</guid>
      <dc:creator>gabarrygowin</dc:creator>
      <dc:date>2020-09-29T20:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Where for _time from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444320#M168319</link>
      <description>&lt;P&gt;Where did you try adding &lt;CODE&gt;where&lt;/CODE&gt;?/&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jul 2018 13:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444320#M168319</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-07-15T13:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Where for _time from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444321#M168320</link>
      <description>&lt;P&gt;You have to have some kind of time/date field.  In this case, I assume that it is either &lt;CODE&gt;_time&lt;/CODE&gt; (which you would have been droppeing) or &lt;CODE&gt;AuditUnixTime&lt;/CODE&gt;, so this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ga_kvstore_lookup
| where AuditUnixTime&amp;gt;=relative_time(now(),"-mon@mon")
| fields _key, AppName, AuditorName, AuditDateTime, ComplianceCheck
| rename _key AS KeyID
| sort 0 -AuditUnixTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You always filter as soon as possible, so move the &lt;CODE&gt;where&lt;/CODE&gt; all the way up.&lt;BR /&gt;
Never use &lt;CODE&gt;table&lt;/CODE&gt; in the middle (use &lt;CODE&gt;fields&lt;/CODE&gt; instead); &lt;CODE&gt;table&lt;/CODE&gt; pulls all events back to the Search Head, killing Indexer benefit.&lt;BR /&gt;
Always use &lt;CODE&gt;sort #&lt;/CODE&gt;, ( &lt;CODE&gt;sort 0&lt;/CODE&gt; usually) because the default is &lt;CODE&gt;sort 100&lt;/CODE&gt;, which will bite you.&lt;BR /&gt;
Never use &lt;CODE&gt;eval&lt;/CODE&gt; when &lt;CODE&gt;rename&lt;/CODE&gt; will do; saves CPU and RAM.&lt;BR /&gt;
Perhaps the lookup has a &lt;CODE&gt;_time&lt;/CODE&gt; field so try &lt;CODE&gt;where _time&lt;/CODE&gt; instead of &lt;CODE&gt;where AuditUnixTime&lt;/CODE&gt; first.&lt;BR /&gt;
Also, &lt;CODE&gt;AuditUnixTime&lt;/CODE&gt; is probably a &lt;CODE&gt;stirng&lt;/CODE&gt; instead of a &lt;CODE&gt;time_t&lt;/CODE&gt; (AKA &lt;CODE&gt;epoch&lt;/CODE&gt;), so you will surely need to do a &lt;CODE&gt;| eval AuditUnixTime = strptime(AuditUnixTime, "Some Format Here")&lt;/CODE&gt; before the &lt;CODE&gt;| where&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jul 2018 15:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444321#M168320</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-15T15:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Where for _time from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444322#M168321</link>
      <description>&lt;P&gt;Hey Woodcock,&lt;/P&gt;

&lt;P&gt;Thanks for the reply.&lt;/P&gt;

&lt;P&gt;To clarify, the contractor has these going to a keystore vice a normal lookup (as I'm used to).  &lt;/P&gt;

&lt;P&gt;When running any of the where to _time (which doesn't appear to be in his table) I get no results.  &lt;/P&gt;

&lt;P&gt;I don't want to write to the keystore with this new search, just present the information for the last week of audits.&lt;/P&gt;

&lt;P&gt;Tried the following with '0 results'.  If I run the originally reported search, I get ALL/EVERY entry every put into the kvstore.  &lt;/P&gt;

&lt;P&gt;| inputlookup ga_kvstore_lookup&lt;BR /&gt;
 | where AuditUnixTime&amp;gt;=relative_time(now(),"@Week")&lt;BR /&gt;
| fields _key, AppName, AuditorName, AuditDateTime, ComplianceCheck&lt;BR /&gt;
| rename _key AS KeyID&lt;BR /&gt;
| sort 0 -AuditUnixTime&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:29:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444322#M168321</guid>
      <dc:creator>gabarrygowin</dc:creator>
      <dc:date>2020-09-29T20:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Where for _time from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444323#M168322</link>
      <description>&lt;P&gt;I told you that you almost certainly will have to convert &lt;CODE&gt;AuditUnixTime&lt;/CODE&gt; and yet you didn't do that and you didn't show us the format of that field.  We need more information.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jul 2018 20:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-Where-for-time-from-lookup/m-p/444323#M168322</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-15T20:51:48Z</dc:date>
    </item>
  </channel>
</rss>

