<?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: _time in stats command displays in Epoch when count is greater than 1 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585338#M203923</link>
    <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;said the issue is how splunk manages _time on GUI. In GUI it will automatic convert it to your local TZ (actually what you have defined on client settings) based human readable values. But when you are using stats values(_time) you haven't anymore field _time instead your field name is "values(_time)" and for that splunk don't do any automatic conversation. When you rename those fields "rename values(*) as *" you get back field _time and splunk shows it again correctly.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;'s answer is easy way to fix it . Another options is use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;stats values(user_type) as user_type, values(_time) as _time, values(eventName) as eventName count by user_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(needs that eval _time to drop ms away) or you could try convert like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| convert timeformat="%F %T" ctime(values(_time))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which works also with many _time values (with or without ms part).&lt;/P&gt;&lt;P&gt;There are also some other ways to fix it. But the real issue is how splunk GUI handle _time field vs. other fields which has epoch times.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 13:02:37 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2022-02-16T13:02:37Z</dc:date>
    <item>
      <title>How can I get _time in stats command displays in Epoch when count is greater than 1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585326#M203913</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; The below search displays&amp;nbsp; _time in human readable format when &lt;STRONG&gt;count&lt;/STRONG&gt;&amp;nbsp; of the results =1 but in EPOCH format when &lt;STRONG&gt;count&lt;/STRONG&gt; &amp;gt; 1.&amp;nbsp; &amp;nbsp;How can i get it to display &lt;STRONG&gt;_time&lt;/STRONG&gt; value in&amp;nbsp; human readable format when count &amp;gt; 1 as well ?&amp;nbsp; Notice Rows number 2 ,4 and 5 in my results...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=aws
stats values(user_type), values(_time), values(eventName) count by user_name
|rename values(*) as * &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="neerajs_81_0-1645010820666.png" style="width: 632px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17998i42F7F3134E57F4E2/image-dimensions/632x270?v=v2" width="632" height="270" role="button" title="neerajs_81_0-1645010820666.png" alt="neerajs_81_0-1645010820666.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 23:43:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585326#M203913</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-02-16T23:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585329#M203916</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is normal because _time is naturally in epochtime.&lt;/P&gt;&lt;P&gt;There's an automatic tranlaction if you have one value.&lt;/P&gt;&lt;P&gt;You have two choices:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;use eval before stats to have all the values in human Readable format,&lt;/LI&gt;&lt;LI&gt;use earliest or latest instead values in the stats command, so you'll have only one value.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 11:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585329#M203916</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-02-16T11:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585330#M203917</link>
      <description>&lt;P&gt;Use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/DateandTimeFunctions#strftime.28X.2CY.29" target="_blank" rel="noopener"&gt;strftime()&lt;/A&gt;&amp;nbsp;before using values(_time); for example,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws
| eval _time = strftime(_time, "%F %H:%M:%S")
|stats values(user_type), values(_time), values(eventName) count by user_name
|rename values(*) as * &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 11:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585330#M203917</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-02-16T11:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585331#M203918</link>
      <description>&lt;P&gt;Thank you Legend &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 12:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585331#M203918</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-02-16T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585338#M203923</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;said the issue is how splunk manages _time on GUI. In GUI it will automatic convert it to your local TZ (actually what you have defined on client settings) based human readable values. But when you are using stats values(_time) you haven't anymore field _time instead your field name is "values(_time)" and for that splunk don't do any automatic conversation. When you rename those fields "rename values(*) as *" you get back field _time and splunk shows it again correctly.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;'s answer is easy way to fix it . Another options is use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;stats values(user_type) as user_type, values(_time) as _time, values(eventName) as eventName count by user_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(needs that eval _time to drop ms away) or you could try convert like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| convert timeformat="%F %T" ctime(values(_time))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which works also with many _time values (with or without ms part).&lt;/P&gt;&lt;P&gt;There are also some other ways to fix it. But the real issue is how splunk GUI handle _time field vs. other fields which has epoch times.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 13:02:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585338#M203923</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-02-16T13:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585343#M203926</link>
      <description>&lt;P&gt;Close, but simply doing values(_time) as _time won't do.&lt;/P&gt;&lt;P&gt;The reason is that, as we all know, _time as a field within the event is a numeric field. Also the webui will try to render a field, it it's called _time, as a unix timestamp field into a string value.&lt;/P&gt;&lt;P&gt;Problem with multivalued field is that it's not a single number. I'm not sure how it's treated internally, but "on the outside", unless interpreted as multivalued field, it's treated more or less like a string.&lt;/P&gt;&lt;P&gt;That's why the webui won't be able to render the timestamp to a date string because it has no single numeric timestamp to render in the first place.&lt;/P&gt;&lt;P&gt;Contrary to other proposed solutions I would not advise using eval, but fieldformat, because it leaves the underlying timestamp untouched. And you can perfectly well apply it after doing your stats magic.&lt;/P&gt;&lt;P&gt;So you can try.&lt;/P&gt;&lt;PRE&gt;index=aws&lt;BR /&gt;stats values(user_type), values(_time), values(eventName) count by user_name&lt;BR /&gt;|rename values(*) as *&lt;BR /&gt;| fieldformat _time=strftime(_time,"%c")&lt;/PRE&gt;&lt;P&gt;I'd however suggest you chose another field name for that timestamp field because webui not only tries to render the timestamp to a date string but also flattens the multivalued field to a single string.&lt;/P&gt;&lt;P&gt;That's simply one of the quirks of the WebUI (which usually works for the user's good but sometimes can be confusing).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 13:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585343#M203926</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-16T13:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585346#M203928</link>
      <description>&lt;P&gt;Thank you for the detailed information.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 13:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585346#M203928</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-02-16T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585447#M203969</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;said, it's a mere quick fix. &amp;nbsp;You may want to consider&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;'s points:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use a different field name for string and leave _time in its native format. &amp;nbsp;This may not matter in one or the other use case, but I often get confused when a builtin variable suddenly doesn't behave as I expected, then realize that I did something to change it.&lt;/LI&gt;&lt;LI&gt;Are multiple timestamps good for the column, or should you consider min(_time), max(_time), avg(_time), &amp;nbsp;max(_time):min(_time), etc. as a single value? (Personally I find multiple timestamps in one row distracting.)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 16 Feb 2022 22:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585447#M203969</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-02-16T22:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: _time in stats command displays in Epoch when count is greater than 1</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585462#M203975</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;for the detailed information. Marking your response as solution.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 03:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-time-in-stats-command-displays-in-Epoch-when-count/m-p/585462#M203975</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-02-17T03:55:13Z</dc:date>
    </item>
  </channel>
</rss>

