<?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: How to write a search using an eval object with a wildcard? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216776#M63640</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | where LIKE(DATE_FIELD,strftime(now(), "%Y%m%d") ."_%")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | where match(DATE_FIELD,strftime(now(), "%Y%m%d") ."_.*")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Apr 2016 16:28:03 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-04-19T16:28:03Z</dc:date>
    <item>
      <title>How to write a search using an eval object with a wildcard?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216775#M63639</link>
      <description>&lt;P&gt;I am trying to use an eval object as the basis of a search pattern along with a wildcard and Splunk is not happy with my efforts.&lt;/P&gt;

&lt;P&gt;I have a field (&lt;STRONG&gt;DATE_FIELD&lt;/STRONG&gt;) with data such as &lt;CODE&gt;20160419_003425&lt;/CODE&gt; and I'm trying to collect all of the current day's events only:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;create a variable with today's date &amp;gt; search against a field using variable + wildcard&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Tried:&lt;BR /&gt;
index=myIndex | eval now=now(), today=strftime(now(), "%Y%m%d") | search DATE_FIELD = `today`*       &lt;EM&gt;&amp;gt;&amp;gt; throws error&lt;/EM&gt;&lt;BR /&gt;
index=myIndex | eval now=now(), today=strftime(now(), "%Y%m%d") | search DATE_FIELD = today*&lt;BR /&gt;
index=myIndex | eval now=now(), today=strftime(now(), "%Y%m%d") | where DATE_FIELD = `today`*&lt;BR /&gt;
index=myIndex | eval now=now(), today=strftime(now(), "%Y%m%d") | where DATE_FIELD = today*&lt;BR /&gt;
index=myIndex | eval now=now(), today=strftime(now(), "%Y%m%d") |  where like(DATE_FIELD, "today%")&lt;/P&gt;

&lt;P&gt;Feel like there's an obvious way to accomplish this, but haven't located it yet; requirement is current day (and current day only).  Of course, enjoy the simpler solution rather than over-engineering (sure I &lt;EM&gt;could&lt;/EM&gt; make a three-line regex...)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:30:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216775#M63639</guid>
      <dc:creator>sfellin</dc:creator>
      <dc:date>2020-09-29T09:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search using an eval object with a wildcard?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216776#M63640</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | where LIKE(DATE_FIELD,strftime(now(), "%Y%m%d") ."_%")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | where match(DATE_FIELD,strftime(now(), "%Y%m%d") ."_.*")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:28:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216776#M63640</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-19T16:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search using an eval object with a wildcard?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216777#M63641</link>
      <description>&lt;P&gt;Thanks; I used a regex on the field to capture the first 8 digits to compare it to the eval but this is a cleaner approach -- switched!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-using-an-eval-object-with-a-wildcard/m-p/216777#M63641</guid>
      <dc:creator>sfellin</dc:creator>
      <dc:date>2016-04-19T16:38:59Z</dc:date>
    </item>
  </channel>
</rss>

