<?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: How to format earliest_time in mstats command in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571455#M10390</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. That fixed it.&amp;nbsp; For others -&amp;nbsp; &amp;nbsp;Splunk resolves double quoted field names when they are used in a table command but treats them as literals when embedded in commands like stfrtime or when trying to use them in an eval statement. Easy trap to fall into&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2021 03:47:58 GMT</pubDate>
    <dc:creator>perrinj2</dc:creator>
    <dc:date>2021-10-19T03:47:58Z</dc:date>
    <item>
      <title>How to format earliest_time in mstats command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571254#M10363</link>
      <description>&lt;P&gt;I'm using mstats earliest_time(metric) to find the earliest time for metric. If I use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;|mstats prestats=false earliest_time("http_req_duration_value") as "Start Time" where index=au_cpe_common_metrics&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it returns a "Start Time" like&amp;nbsp;&lt;SPAN&gt;1633986822.000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I want to be able to display this time in human readable format on a dashboard however when I try&amp;nbsp;&lt;/P&gt;&lt;P&gt;~~~&lt;/P&gt;&lt;P&gt;|mstats prestats=false earliest_time("http_req_duration_value") as "Start Time" where index=au_cpe_common_metrics&lt;BR /&gt;| eval STime2=strftime("Start Time", "%d/%m/%Y %H:%M:%S")|table STime2&lt;/P&gt;&lt;P&gt;~~~&lt;/P&gt;&lt;P&gt;I get no results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd also like to be able to subtract earliest_time from latest_time to get the duration of the event based on other dimensions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I also tried prestats = true but it&amp;nbsp; returned no Time values in the events.&lt;/P&gt;&lt;P&gt;What format is earliest time in and why can't&amp;nbsp; I format it or do calculations with the value?&lt;/P&gt;&lt;P&gt;What is happening here? I'm new to operating with metric indexes&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 04:16:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571254#M10363</guid>
      <dc:creator>perrinj2</dc:creator>
      <dc:date>2021-10-18T04:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to format earliest_time in mstats command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571270#M10367</link>
      <description>&lt;P&gt;Try single quotes around the field name&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval STime2=strftime('Start Time', "%d/%m/%Y %H:%M:%S")|table STime2&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Oct 2021 07:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571270#M10367</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-18T07:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to format earliest_time in mstats command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571455#M10390</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. That fixed it.&amp;nbsp; For others -&amp;nbsp; &amp;nbsp;Splunk resolves double quoted field names when they are used in a table command but treats them as literals when embedded in commands like stfrtime or when trying to use them in an eval statement. Easy trap to fall into&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 03:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571455#M10390</guid>
      <dc:creator>perrinj2</dc:creator>
      <dc:date>2021-10-19T03:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to format earliest_time in mstats command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571456#M10391</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64270"&gt;@perrinj2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should always use single quotes in eval statements for field names that do not just consist of standard letters or numbers. Also, if the field name starts with a number, you must use single quotes. However, note that the LEFT hand side of the eval statement does not use single quotes, it uses double.&lt;/P&gt;&lt;P&gt;To illustrate&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval "Start Time" = strftime('Start Time', "%d/%m/%Y %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;the left hand side uses double quotes, but inside the eval function, it uses single quotes.&lt;/P&gt;&lt;P&gt;Your example is due to the space in the field name 'Start Time'. If you had used StartTime, you would not need single quotes in the eval.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you ever have JSON fields in your data, then you will always have to use single quotes when wrapping a field name containing a . (period)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 04:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-format-earliest-time-in-mstats-command/m-p/571456#M10391</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-10-19T04:23:15Z</dc:date>
    </item>
  </channel>
</rss>

