<?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 Look up in CSV date in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356261#M105433</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have CSV with below fields and values&lt;/P&gt;

&lt;P&gt;**&lt;STRONG&gt;&lt;EM&gt;Login_count *&lt;/EM&gt;&lt;/STRONG&gt;**  Logging_Time********* Application_name******&lt;BR /&gt;
***&lt;STRONG&gt;&lt;EM&gt;2888&lt;/EM&gt;&lt;/STRONG&gt;*******&lt;STRONG&gt;&lt;EM&gt;2017-02-28T00:00:00.000-0800&lt;/EM&gt;&lt;/STRONG&gt;****** App1+&lt;/P&gt;

&lt;H2&gt;***&lt;STRONG&gt;&lt;EM&gt;2888&lt;/EM&gt;&lt;/STRONG&gt;*******&lt;STRONG&gt;&lt;EM&gt;2017-02-28T00:00:00.000-0800&lt;/EM&gt;&lt;/STRONG&gt;****** App2+&lt;/H2&gt;

&lt;P&gt;I have below query, I am trying to draw bar charts on weekly basis using below query, however looks like the Logging_Time is not behaving or recognizing as Time field. &lt;/P&gt;

&lt;P&gt;Can you guys help me, how to make Logging_Time same as _time and make below query to work.&lt;/P&gt;

&lt;P&gt;| inputlookup lookup.csv|where  application="APP1" |eval period=case(_time&amp;gt;=relative_time(now(),"-7d@d"),"*Current Week",(Logging_Time&amp;gt;=relative_time(now(),"-14d@d")  AND _time=relative_time(now(),"-21d@d")  AND Logging_Time=relative_time(now(),"-28d@d")  AND Logging_Time&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:14:34 GMT</pubDate>
    <dc:creator>smaran06</dc:creator>
    <dc:date>2020-09-29T13:14:34Z</dc:date>
    <item>
      <title>Look up in CSV date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356261#M105433</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have CSV with below fields and values&lt;/P&gt;

&lt;P&gt;**&lt;STRONG&gt;&lt;EM&gt;Login_count *&lt;/EM&gt;&lt;/STRONG&gt;**  Logging_Time********* Application_name******&lt;BR /&gt;
***&lt;STRONG&gt;&lt;EM&gt;2888&lt;/EM&gt;&lt;/STRONG&gt;*******&lt;STRONG&gt;&lt;EM&gt;2017-02-28T00:00:00.000-0800&lt;/EM&gt;&lt;/STRONG&gt;****** App1+&lt;/P&gt;

&lt;H2&gt;***&lt;STRONG&gt;&lt;EM&gt;2888&lt;/EM&gt;&lt;/STRONG&gt;*******&lt;STRONG&gt;&lt;EM&gt;2017-02-28T00:00:00.000-0800&lt;/EM&gt;&lt;/STRONG&gt;****** App2+&lt;/H2&gt;

&lt;P&gt;I have below query, I am trying to draw bar charts on weekly basis using below query, however looks like the Logging_Time is not behaving or recognizing as Time field. &lt;/P&gt;

&lt;P&gt;Can you guys help me, how to make Logging_Time same as _time and make below query to work.&lt;/P&gt;

&lt;P&gt;| inputlookup lookup.csv|where  application="APP1" |eval period=case(_time&amp;gt;=relative_time(now(),"-7d@d"),"*Current Week",(Logging_Time&amp;gt;=relative_time(now(),"-14d@d")  AND _time=relative_time(now(),"-21d@d")  AND Logging_Time=relative_time(now(),"-28d@d")  AND Logging_Time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356261#M105433</guid>
      <dc:creator>smaran06</dc:creator>
      <dc:date>2020-09-29T13:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in CSV date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356262#M105434</link>
      <description>&lt;P&gt;Convert string Time to epoch time using strptime() function&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Logging_Time= strptime(Logging_Time,"%Y-%m-%dT%H:%M:%S.%3N%z")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need string time for displaying you can use fieldformat on Logging_Time along with strftime to convert to string time only for display (underlying Logging_Time) field will continue to be epoch time. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356262#M105434</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T13:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in CSV date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356263#M105435</link>
      <description>&lt;P&gt;Thanks for the reply, this didn't help. it stopped showing the results after adding this change&lt;/P&gt;

&lt;P&gt;| inputlookup lookup.csv|where application="APP1"| eval Logging_Time= strptime(Logging_Time,"%Y-%m-%dT%H:%M:%S.%3N%z") |eval period=case(_time&amp;gt;=relative_time(now(),"-7d@d"),"*Current Week",(Logging_Time&amp;gt;=relative_time(now(),"-14d@d") AND _time=relative_time(now(),"-21d@d") AND Logging_Time=relative_time(now(),"-28d@d") AND Logging_Time&lt;/P&gt;

&lt;P&gt;Infact, I had modified the query as below but no results.&lt;/P&gt;

&lt;P&gt;| inputlookup lookup.csv|where application="APP1"| eval Logging_Time= strptime(Logging_Time,"%Y-%m-%dT%H:%M:%S.%3N%z")|table Logging_Time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:15:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356263#M105435</guid>
      <dc:creator>smaran06</dc:creator>
      <dc:date>2020-09-29T13:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in CSV date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356264#M105436</link>
      <description>&lt;P&gt;@smaran06 What happens when you run. Do you see epoch time?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lookup.csv|eval Logging_Time= strptime(Logging_Time,"%Y-%m-%dT%H:%M:%S.%3N%z")|table Logging_Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your example you have &lt;STRONG&gt;Application_name&lt;/STRONG&gt; as field name and you are performing filter based on &lt;STRONG&gt;application&lt;/STRONG&gt; field name in your query. In your example you have application names like &lt;STRONG&gt;App1+&lt;/STRONG&gt;, &lt;STRONG&gt;App2+&lt;/STRONG&gt;. Are they the exact values? Based on whatever is the Application name in your lookup file please try the following instead of where:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup lookup.csv|search application="APP1*"| eval Logging_Time= strptime(Logging_Time,"%Y-%m-%dT%H:%M:%S.%3N%z")|table Logging_Time application
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the second query that you have run, seems like the issue is with where condition itself. Try the following search as well and see if &lt;STRONG&gt;application&lt;/STRONG&gt; is printed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; inputlookup lookup.csv|where application="APP1"
| table application
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 18:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356264#M105436</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-15T18:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Look up in CSV date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356265#M105437</link>
      <description>&lt;P&gt;This works for me thanks a lot&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 20:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Look-up-in-CSV-date/m-p/356265#M105437</guid>
      <dc:creator>smaran06</dc:creator>
      <dc:date>2017-03-15T20:59:12Z</dc:date>
    </item>
  </channel>
</rss>

