<?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 do you return Boolean if today matches the dates listed in lookups table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406103#M117411</link>
    <description>&lt;P&gt;@chrisyoungerjds Thanks! I added dateflag as second column in mydates.csv. I also included today’s date in mydates.csv file and ran query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abcd name=user1 action=login
|eval Date = strftime(now(), “%m/%d/%Y”)
|lookup mydates.csv Date OUTPUTNEW  dateflag
|table dateflag Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was getting empty string in dateflag. Also, I tried to add:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to see event counts. This seems not working .&lt;/P&gt;</description>
    <pubDate>Sun, 24 Feb 2019 07:32:21 GMT</pubDate>
    <dc:creator>lucy2019</dc:creator>
    <dc:date>2019-02-24T07:32:21Z</dc:date>
    <item>
      <title>How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406095#M117403</link>
      <description>&lt;P&gt;I have mydates.csv file uploaded to Splunk lookups. It looks like this:&lt;/P&gt;

&lt;P&gt;Date&lt;BR /&gt;
1/2/2019&lt;BR /&gt;
2/5/2019&lt;BR /&gt;
2/16/2019&lt;/P&gt;

&lt;P&gt;I need to add date check function to my search, so it will check if today’s date is listed in mydates.csv file. If it is, then create dayflag=YES. Otherwise, set dayflag=NO.  &lt;/P&gt;

&lt;P&gt;How can I do this?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 22:20:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406095#M117403</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-22T22:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406096#M117404</link>
      <description>&lt;P&gt;Something like this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup YOURDATA.csv
| eval today = strftime(now(), "%d/%m/%Y")
| eval dayflag = if(today==DATE_FIELD, "yes", "no")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 22:24:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406096#M117404</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-22T22:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406097#M117405</link>
      <description>&lt;P&gt;@chrisyoungerjds Thank you! I added your query after my search, I got 0 events returned while my own search should return some events. My search looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Index=abcd name=user1 action=login [|inputlookup mydates.csv |eval today=strftime(now(), “%d/%m/%Y”) |eval dayflag=if(today==Date, “y”, “n”)]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Am I missing anything here?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 22:54:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406097#M117405</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-22T22:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406098#M117406</link>
      <description>&lt;P&gt;Index=abcd name=user1 action=login  |eval today=strftime(now(), “%d/%m/%Y”) |inputlookup today AS Date mydates.csv  &lt;/P&gt;

&lt;P&gt;the above will return results if today's date matches the date in the lookup table&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 23:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406098#M117406</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-02-22T23:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406099#M117407</link>
      <description>&lt;P&gt;Hi @lucy2019 &lt;/P&gt;

&lt;P&gt;There are a few different ways it could work. Can you supply more details about your existing search? and possibly a tiny bit of sample data. We will be able to help you better that way.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 23:37:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406099#M117407</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-22T23:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406100#M117408</link>
      <description>&lt;P&gt;@lakshman239 Thanks! However, this returned error ‘AS is invalid argument for inputlook.’. &lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 01:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406100#M117408</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-23T01:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406101#M117409</link>
      <description>&lt;P&gt;@chrisyoungerjds My search is very simple. Just pull the login activities for a user. So it  looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=abcd name=user1 action=login
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My data would look like this:&lt;BR /&gt;
timestamp: 2-22-2019 02:02:05 name=user1 action= login info= success src_ip= x.x.x.x&lt;/P&gt;

&lt;P&gt;My goal is, if I run this every hour, I need to all login activities for user1 for the hour. And ii also need to check today’s date against lookup table. If it matches any date in the lookup table, then create dayflag and set to ‘y’. Otherwise, set dayflag to ‘n’.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 02:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406101#M117409</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-23T02:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406102#M117410</link>
      <description>&lt;P&gt;OK I understand now. If you have your CSV with (at least) two columns like so:&lt;/P&gt;

&lt;P&gt;Date,DateFlag&lt;BR /&gt;
01/01/2019,y&lt;/P&gt;

&lt;P&gt;then you can do a query like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abcd name=user1 action=login 
|eval Date = strftime(now(), “%d/%m/%Y”) 
|lookup mydates.csv Date OUTPUTNEW dateflag
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Feb 2019 03:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406102#M117410</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-23T03:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406103#M117411</link>
      <description>&lt;P&gt;@chrisyoungerjds Thanks! I added dateflag as second column in mydates.csv. I also included today’s date in mydates.csv file and ran query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abcd name=user1 action=login
|eval Date = strftime(now(), “%m/%d/%Y”)
|lookup mydates.csv Date OUTPUTNEW  dateflag
|table dateflag Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was getting empty string in dateflag. Also, I tried to add:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to see event counts. This seems not working .&lt;/P&gt;</description>
      <pubDate>Sun, 24 Feb 2019 07:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406103#M117411</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-24T07:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406104#M117412</link>
      <description>&lt;P&gt;Are there any errors displayed when you run my search?&lt;/P&gt;

&lt;P&gt;If not, are you sure that the date format in the csv and returned for "Date" are exactly the same?&lt;/P&gt;</description>
      <pubDate>Sun, 24 Feb 2019 07:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406104#M117412</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-24T07:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406105#M117413</link>
      <description>&lt;P&gt;There were no errors. Date field returned the same as it is listed in .csv file.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Feb 2019 08:00:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406105#M117413</guid>
      <dc:creator>lucy2019</dc:creator>
      <dc:date>2019-02-24T08:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406106#M117414</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abcd name=user1 action=login
| eval day_flag = 
[| makeresults
| eval now=relative_time(now(), "@d")
| search
[|inputlookup mydates.csv
| table Date
| eval now = strptime(Date, "%m/%d/%Y")
| table now
| format]
| stats count AS day_flag
| return $day_flag]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives &lt;CODE&gt;0&lt;/CODE&gt; for &lt;CODE&gt;false&lt;/CODE&gt; and &lt;CODE&gt;1&lt;/CODE&gt; for &lt;CODE&gt;true&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 06:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406106#M117414</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-28T06:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you return Boolean if today matches the dates listed in lookups table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406107#M117415</link>
      <description>&lt;P&gt;Hey, @lucy2019, did you get an answer?  Come back and give us an update!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 04:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-return-Boolean-if-today-matches-the-dates-listed-in/m-p/406107#M117415</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-06T04:14:17Z</dc:date>
    </item>
  </channel>
</rss>

