<?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: group by date? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50089#M9527</link>
    <description>&lt;P&gt;_time be propagated to each new event, meaning that each new event will retain the _time information from its parent event.  I'm unsure why you wouldn't be able to group by date_hour or use a timechart per_day()...  Are you using a fields command earlier in your search?  Can you post your complete search?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:40:46 GMT</pubDate>
    <dc:creator>wpreston</dc:creator>
    <dc:date>2020-09-28T14:40:46Z</dc:date>
    <item>
      <title>group by date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50085#M9523</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;

&lt;P&gt;Given: In my search I am using &lt;CODE&gt;stats values()&lt;/CODE&gt; at some point. I am not sure, but this is making me loose track of _time and due to which I am not able to use either of &lt;CODE&gt;timechart per_day(eval())&lt;/CODE&gt; or &lt;CODE&gt;count(eval()) by date_hour&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Part of search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(code) as CODES by USER
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Current state:&lt;BR /&gt;
USER CODES(Multi-value)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;a    11, 12, 13
b    14, 19, 13
c    15, 12, 13
d    18, 12, 14
e    11, 14, 17
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Desired: count CODES by date.&lt;BR /&gt;
CODES COUNT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11    2
12    3
13    3
14    3
15    1
17    1
18    1
19    1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I am not wrong, &lt;CODE&gt;values(code)&lt;/CODE&gt; is making me loose track of &lt;CODE&gt;_time&lt;/CODE&gt;. Is there a way to get this back?&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;Can I group on custom timestamp obtained from logs?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(code) as CODES by USER values(timestamp) as TS 
| eval TSN = mvindex(TS, 0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Some how can I use TSN for group by date?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:40:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50085#M9523</guid>
      <dc:creator>theeven</dc:creator>
      <dc:date>2020-09-28T14:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: group by date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50086#M9524</link>
      <description>&lt;P&gt;Yes, I think &lt;STRONG&gt;values()&lt;/STRONG&gt; is messing up your aggregation.  I would suggest a different approach.  Use &lt;STRONG&gt;mvexpand&lt;/STRONG&gt; which will create a new event for each value of your 'code' field.  Then just use a regular stats or chart count by date_hour to aggregate:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search... | mvexpand code | stats count as "USER CODES" by date_hour, USER
             or
...your search... | mvexpand code | chart count as "USER CODES" by date_hour, USER
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2013 19:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50086#M9524</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2013-08-28T19:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: group by date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50087#M9525</link>
      <description>&lt;P&gt;This approach looks like on the right track as it gives me back line by line entries. But after &lt;CODE&gt;mvexpand&lt;/CODE&gt; its not able to recover &lt;CODE&gt;_time&lt;/CODE&gt; field, hence not able group &lt;CODE&gt;by date_hour&lt;/CODE&gt; OR &lt;CODE&gt;timechart per_day()&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;In other case, I was wondering if its possible to use my log &lt;CODE&gt;timestamp&lt;/CODE&gt; field for grouping?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 21:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50087#M9525</guid>
      <dc:creator>theeven</dc:creator>
      <dc:date>2013-08-28T21:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: group by date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50088#M9526</link>
      <description>&lt;P&gt;here's how I have resolved this problem, considering I am loosing &lt;CODE&gt;_time&lt;/CODE&gt; field after &lt;CODE&gt;values()&lt;/CODE&gt;. I am now using &lt;CODE&gt;timestamp&lt;/CODE&gt; from logs and grouping over them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(code) as CODES by USER values(timestamp) as TS 
| eval TSN = mvindex(TS, 0) 
| eval HOUR=strftime(TSN,"%H:00") 
| stats count(eval(CODES="11")) by HOUR
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;above will give hourly counts for &lt;CODE&gt;CODE="11"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2013 00:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50088#M9526</guid>
      <dc:creator>theeven</dc:creator>
      <dc:date>2013-08-29T00:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: group by date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50089#M9527</link>
      <description>&lt;P&gt;_time be propagated to each new event, meaning that each new event will retain the _time information from its parent event.  I'm unsure why you wouldn't be able to group by date_hour or use a timechart per_day()...  Are you using a fields command earlier in your search?  Can you post your complete search?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/group-by-date/m-p/50089#M9527</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2020-09-28T14:40:46Z</dc:date>
    </item>
  </channel>
</rss>

