<?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 Finding/displaying date range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135096#M36927</link>
    <description>&lt;P&gt;I have a process running on 50 servers that processes 4 files into a SQL DB and then writes to a log file the name of those 4 files Mon-Fri mornings. I have an additional central server that writes the same 50 sets of data to 50 databases on it's SQL installation and again writes the names of the files to 50 different log files. Each of these 4 files start with a specific 8 character name prefix and then have a unique by date naming convention suffix.&lt;/P&gt;

&lt;P&gt;I'm trying to figure out how to make Splunk look through the log files for the last grouping of fileA,fileB,fileC,fileD that took place within 4 hours of each other and display the date that this happened by host.&lt;/P&gt;

&lt;P&gt;I've tried defining fields and using DC(fieldname) and I've tried using transactions to group the 4 files types but I'm not making any progress on returning the result set I'm looking for.&lt;/P&gt;

&lt;P&gt;Thank You&lt;/P&gt;</description>
    <pubDate>Thu, 17 Apr 2014 13:19:35 GMT</pubDate>
    <dc:creator>jsmith39</dc:creator>
    <dc:date>2014-04-17T13:19:35Z</dc:date>
    <item>
      <title>Finding/displaying date range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135096#M36927</link>
      <description>&lt;P&gt;I have a process running on 50 servers that processes 4 files into a SQL DB and then writes to a log file the name of those 4 files Mon-Fri mornings. I have an additional central server that writes the same 50 sets of data to 50 databases on it's SQL installation and again writes the names of the files to 50 different log files. Each of these 4 files start with a specific 8 character name prefix and then have a unique by date naming convention suffix.&lt;/P&gt;

&lt;P&gt;I'm trying to figure out how to make Splunk look through the log files for the last grouping of fileA,fileB,fileC,fileD that took place within 4 hours of each other and display the date that this happened by host.&lt;/P&gt;

&lt;P&gt;I've tried defining fields and using DC(fieldname) and I've tried using transactions to group the 4 files types but I'm not making any progress on returning the result set I'm looking for.&lt;/P&gt;

&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2014 13:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135096#M36927</guid>
      <dc:creator>jsmith39</dc:creator>
      <dc:date>2014-04-17T13:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding/displaying date range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135097#M36928</link>
      <description>&lt;P&gt;Do post some sample events.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2014 18:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135097#M36928</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-17T18:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Finding/displaying date range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135098#M36929</link>
      <description>&lt;P&gt;In a typical 2 day (work week) period, each of the 51 servers will post to it's work log something similar to &lt;/P&gt;

&lt;P&gt;SAT_FILE004H01  was processed:  4/17/2014 4:02:16 AM&lt;BR /&gt;
APPL_EXT004H01  was processed:  4/17/2014 4:04:42 AM&lt;BR /&gt;
SVC_SAT_FI4H01  was processed:  4/17/2014 4:04:55 AM&lt;BR /&gt;
PCP_FILE004H01  was processed:  4/17/2014 4:06:03 AM&lt;BR /&gt;
SAT_FILE004I01  was processed:  4/18/2014 4:02:32 AM&lt;BR /&gt;
APPL_EXT004I01  was processed:  4/18/2014 4:05:01 AM&lt;BR /&gt;
SVC_SAT_FI4I01  was processed:  4/18/2014 4:05:09 AM&lt;BR /&gt;
PCP_FILE004I01  was processed:  4/18/2014 4:06:20 AM&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135098#M36929</guid>
      <dc:creator>jsmith39</dc:creator>
      <dc:date>2020-09-28T16:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Finding/displaying date range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135099#M36930</link>
      <description>&lt;P&gt;Assuming you have the timestamp properly recognized in &lt;CODE&gt;_time&lt;/CODE&gt;, the file name extracted in &lt;CODE&gt;file&lt;/CODE&gt;, and the host correctly stored in &lt;CODE&gt;host&lt;/CODE&gt;, you could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search yielding only these events | eval day = strftime(_time, "%Y-%m-%d") | stats dc(file) as file_count range(_time) as range by day host | where file_count==4 AND range&amp;lt;14400 | sort - day | dedup host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will group events by day and host, count the number of distinct files processed and compute the difference between first and last timestamp. Using that, only rows with four files and a range less than four hours will be kept. Sort by day descending, only keep the first (= newest) row per host.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2014 12:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135099#M36930</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-18T12:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding/displaying date range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135100#M36931</link>
      <description>&lt;P&gt;That worked perfectly, thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2014 12:50:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-displaying-date-range/m-p/135100#M36931</guid>
      <dc:creator>jsmith39</dc:creator>
      <dc:date>2014-04-18T12:50:43Z</dc:date>
    </item>
  </channel>
</rss>

