<?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: Search with where to filter based on wildcard variable in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321043#M59892</link>
    <description>&lt;P&gt;No, 2018-01-21 logs still there &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 09:39:03 GMT</pubDate>
    <dc:creator>splunkreal</dc:creator>
    <dc:date>2018-01-22T09:39:03Z</dc:date>
    <item>
      <title>Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321041#M59890</link>
      <description>&lt;P&gt;Could you let me know why the results are not filtered (I hidden sensible data) with | where NOT like (source, "%stimeyesterday%")&lt;/P&gt;

&lt;P&gt;![alt text][1]&lt;/P&gt;

&lt;P&gt;| tstats latest(_time) as latest,earliest(_time) as earliest WHERE (index=* AND ...) by host source sourcetype | eval lastevent=strftime(latest, "%Y-%m-%d %H:%M")    | eval firstevent=strftime(earliest, "%Y-%m-%d %H:%M") &lt;BR /&gt;
... | eval timeYesterday=round(relative_time(now(), "-1d@d"))| eval stimeyesterday=strftime(timeYesterday, "%Y-%m-%d") | eval timeRelative=round(relative_time(now(), "@d")) | where latest &amp;lt; timeRelative  | eval resultat=if(latest &amp;lt; timeRelative,"KO","OK") | eval stimerel=strftime(timeRelative, "%Y-%m-%d %H:%M") | sort host | fields - latest earliest timeRelative timeYesterdayss | where NOT like(source,"%stimeyesterday%")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:45:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321041#M59890</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2020-09-29T17:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321042#M59891</link>
      <description>&lt;P&gt;hey @realsplunk, I do not know what you are trying to achieve you want to filter out &lt;CODE&gt;source&lt;/CODE&gt; which has &lt;CODE&gt;stimeyesterday&lt;/CODE&gt; keyword? then&lt;/P&gt;

&lt;P&gt;instead of &lt;CODE&gt;| where NOT like(source,"%stimeyesterday%")&lt;/CODE&gt; use &lt;CODE&gt;| search NOT source=*stimeyesterday*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 17:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321042#M59891</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-19T17:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321043#M59892</link>
      <description>&lt;P&gt;No, 2018-01-21 logs still there &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 09:39:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321043#M59892</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2018-01-22T09:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321044#M59893</link>
      <description>&lt;P&gt;which is the field that contains date? if you have a value in &lt;CODE&gt;source&lt;/CODE&gt; field then only you can apply this query.&lt;BR /&gt;
This works vertically not horizontally. pls, explain what table you got and what do you want to exclude.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 09:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321044#M59893</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-22T09:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321045#M59894</link>
      <description>&lt;P&gt;see attachment here : &lt;A href="https://answers.splunk.com/storage/attachments/226762-search.png"&gt;https://answers.splunk.com/storage/attachments/226762-search.png&lt;/A&gt; thanks&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 11:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321045#M59894</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2018-01-22T11:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321046#M59895</link>
      <description>&lt;P&gt;Solved by support :&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;| where NOT like(source,stimeyesterday)&lt;BR /&gt;
So, in your query, you can use something like, to add the %% around the filter string beforehand:&lt;BR /&gt;
| eval stimeyesterday="%".strftime(timeYesterday, "%Y-%m-%d")."%"&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 11:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/321046#M59895</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2018-01-22T11:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search with where to filter based on wildcard variable</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/577080#M101936</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/171872"&gt;@splunkreal&lt;/a&gt;&amp;nbsp;, thank you for sharing this, it's quite useful!&lt;BR /&gt;I have similar &lt;STRONG&gt;eval &lt;/STRONG&gt;command:&lt;/P&gt;&lt;P&gt;... | eval year_month=strftime(_time,"%Y-%m")."%" | where like(access_key_1_last_used_date, year_month) OR like(access_key_2_last_used_date, year_month)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;which is setting &lt;STRONG&gt;year_month&lt;/STRONG&gt;&amp;nbsp; to the following format YYYY-MM, e.g. 2021-12 and then search it in&amp;nbsp;&lt;STRONG&gt;access_key_{1,2}_last_used_date&lt;/STRONG&gt;&amp;nbsp;fields&lt;STRONG&gt; ,&amp;nbsp;&lt;/STRONG&gt;which have the following format&amp;nbsp;&lt;SPAN&gt;2021-11-20T00:35:38+00:00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So this is working just fine (thanks to the wildcard "&lt;STRONG&gt;%&lt;/STRONG&gt;"), but if I ONLY change &lt;STRONG&gt;now()&lt;/STRONG&gt; to &lt;STRONG&gt;_time&lt;/STRONG&gt;&amp;nbsp;it is not working.&amp;nbsp; If I simplify the search to:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;...| eval year_month=strftime(now(),"%Y-%m")."%" | table year_month&lt;/P&gt;&lt;P&gt;Both results in the same:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splunk_query_year_month.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17097i6BCC5BF32C8A2560/image-size/medium?v=v2&amp;amp;px=400" role="button" title="splunk_query_year_month.png" alt="splunk_query_year_month.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 15:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Search-with-where-to-filter-based-on-wildcard-variable/m-p/577080#M101936</guid>
      <dc:creator>dstoev</dc:creator>
      <dc:date>2021-12-02T15:07:16Z</dc:date>
    </item>
  </channel>
</rss>

