<?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: Searching events within a time range from csv file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331099#M159818</link>
    <description>&lt;P&gt;You can put second query in saved search set earliest and latest. &lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 03:18:47 GMT</pubDate>
    <dc:creator>sbbadri</dc:creator>
    <dc:date>2017-07-27T03:18:47Z</dc:date>
    <item>
      <title>Searching events within a time range from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331098#M159817</link>
      <description>&lt;P&gt;My search operation consists of two parts&lt;/P&gt;

&lt;P&gt;Part 1: This job runs every 6 hours and keeps appending to the results obtained to a csv file&lt;BR /&gt;
Query1-&amp;gt; &lt;BR /&gt;
index=INDEXA earliest=-6h@h latest=@h sourcetype=ABC "service=randomservice" (api_name=API1 OR api_name=API2 ) [search index=INDEXA earliest=-6h@h latest=@h sourcetype=ABC "service=randomservice"  (api_name=API1  OR api_name=API2 ) | search XYZ= DEF | fields COMMONID | dedup COMMONID ]&lt;BR /&gt;&lt;BR /&gt;
| stats first(_time) as _time, values(XYZ) AS XYZ, values(PQR) AS PQR by COMMONID | fillnull PQR value="NULL" | sort _time | outputcsv append=true testCSV.csv&lt;/P&gt;

&lt;P&gt;Part2: I need to extract the values from the csv within a specified time period. For example all the events between earliest = -1d@d and latest=@d . How do i achieve this, i'm unable to figure this out?&lt;BR /&gt;
Query2-&amp;gt;&lt;BR /&gt;
| inputcsv testCSV.csv | "What query do i need to give here to achieve the desired results?"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331098#M159817</guid>
      <dc:creator>tareddy</dc:creator>
      <dc:date>2020-09-29T15:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Searching events within a time range from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331099#M159818</link>
      <description>&lt;P&gt;You can put second query in saved search set earliest and latest. &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 03:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331099#M159818</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-07-27T03:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Searching events within a time range from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331100#M159819</link>
      <description>&lt;P&gt;I'm facing difficulties in extracting the time from the csv file. Earliest and latest  keywords aren't working. &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 03:49:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331100#M159819</guid>
      <dc:creator>tareddy</dc:creator>
      <dc:date>2017-07-27T03:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Searching events within a time range from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331101#M159820</link>
      <description>&lt;P&gt;| stats earliest(_time) as earliestTime , latest(_time) as latestTime, values(XYZ) AS XYZ, values(PQR) AS PQR by COMMONID  | eval earliest=strftime(earliestTIme,"%Y-%m-%d %H:%M:%S") | eval latest=strftime(latestTime,"%Y-%m-%d %H:%M:%S")| fillnull PQR value="NULL" | sort _time| outputcsv append=true testCSV.csv&lt;/P&gt;

&lt;P&gt;second query &lt;/P&gt;

&lt;P&gt;| inputcsv testCSV.csv | table earliest latest&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331101#M159820</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T15:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Searching events within a time range from csv file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331102#M159821</link>
      <description>&lt;P&gt;Hi @tareddy&lt;BR /&gt;
&lt;EM&gt;| inputcsv testCSV.csv&lt;/EM&gt; , you will get date(human readable or EPOCH, However you had put them   while creating CSV  as &lt;STRONG&gt;STRING&lt;/STRONG&gt;) , so u need to format  string to time using &lt;STRONG&gt;strptime&lt;/STRONG&gt; and &lt;STRONG&gt;strftime&lt;/STRONG&gt; , once you have it in timeformat. you can use filters to get your desired results  &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 08:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-events-within-a-time-range-from-csv-file/m-p/331102#M159821</guid>
      <dc:creator>nawneel</dc:creator>
      <dc:date>2017-07-27T08:36:37Z</dc:date>
    </item>
  </channel>
</rss>

