<?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 Wierd results with rename in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34466#M7430</link>
    <description>&lt;P&gt;This is really strange. It appears that I can either rename _time or format _time but not both. Here are the searches and partial results. Why does this happen?&lt;/P&gt;

&lt;P&gt;sourcetype="solaris3-web-access" /XXYYZZ/ status="200" | timechart count(status) as Logins | convert timeformat="%H:%M:%S" ctime(Hours) as timestr &lt;/P&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;_time ....................................Logins&lt;BR /&gt;&lt;BR /&gt;
6/23/11 12:00:00.000 AM..........82&lt;BR /&gt;&lt;BR /&gt;
6/23/11 12:30:00.000 AM..........91&lt;BR /&gt;&lt;BR /&gt;
6/23/11 1:00:00.000 AM...........3&lt;BR /&gt;&lt;BR /&gt;
6/23/11 1:30:00.000 AM...........84&lt;BR /&gt;&lt;BR /&gt;
6/23/11 2:00:00.000 AM...........23  &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Now include the rename&lt;/P&gt;

&lt;P&gt;sourcetype="solaris3-web-access" /uhpo/ status="200" | convert timeformat="%H:%M:%S" ctime(_time) as timestr | timechart count(status) as Logins | rename _time as Hours&lt;/P&gt;

&lt;P&gt;And get this result:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hours.....................Logins&lt;BR /&gt;&lt;BR /&gt;
1 1308805200..........82&lt;BR /&gt;&lt;BR /&gt;
2 1308807000..........91&lt;BR /&gt;&lt;BR /&gt;
3 1308808800..........3&lt;BR /&gt;&lt;BR /&gt;
4 1308810600..........84&lt;BR /&gt;&lt;BR /&gt;
5 1308812400..........23 &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;What I want is the human readable time and the header to say Hours.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2011 18:45:42 GMT</pubDate>
    <dc:creator>kmattern</dc:creator>
    <dc:date>2011-06-24T18:45:42Z</dc:date>
    <item>
      <title>Wierd results with rename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34466#M7430</link>
      <description>&lt;P&gt;This is really strange. It appears that I can either rename _time or format _time but not both. Here are the searches and partial results. Why does this happen?&lt;/P&gt;

&lt;P&gt;sourcetype="solaris3-web-access" /XXYYZZ/ status="200" | timechart count(status) as Logins | convert timeformat="%H:%M:%S" ctime(Hours) as timestr &lt;/P&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;_time ....................................Logins&lt;BR /&gt;&lt;BR /&gt;
6/23/11 12:00:00.000 AM..........82&lt;BR /&gt;&lt;BR /&gt;
6/23/11 12:30:00.000 AM..........91&lt;BR /&gt;&lt;BR /&gt;
6/23/11 1:00:00.000 AM...........3&lt;BR /&gt;&lt;BR /&gt;
6/23/11 1:30:00.000 AM...........84&lt;BR /&gt;&lt;BR /&gt;
6/23/11 2:00:00.000 AM...........23  &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Now include the rename&lt;/P&gt;

&lt;P&gt;sourcetype="solaris3-web-access" /uhpo/ status="200" | convert timeformat="%H:%M:%S" ctime(_time) as timestr | timechart count(status) as Logins | rename _time as Hours&lt;/P&gt;

&lt;P&gt;And get this result:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hours.....................Logins&lt;BR /&gt;&lt;BR /&gt;
1 1308805200..........82&lt;BR /&gt;&lt;BR /&gt;
2 1308807000..........91&lt;BR /&gt;&lt;BR /&gt;
3 1308808800..........3&lt;BR /&gt;&lt;BR /&gt;
4 1308810600..........84&lt;BR /&gt;&lt;BR /&gt;
5 1308812400..........23 &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;What I want is the human readable time and the header to say Hours.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2011 18:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34466#M7430</guid>
      <dc:creator>kmattern</dc:creator>
      <dc:date>2011-06-24T18:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Wierd results with rename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34467#M7431</link>
      <description>&lt;P&gt;Assuming you dont actually have a field called 'Hours' here, I think your convert clause is having no effect. &lt;/P&gt;

&lt;P&gt;The Splunk UI will automatically convert _time, which is always a number of seconds since 1/1/1970,  into a localized string.    So that's why the _time values in the first example look like "6/23/11 12:30:00.000 AM",  and it doesnt have anything to do with your convert clause. &lt;/P&gt;

&lt;P&gt;In the second example,  by renaming _time you break this behavior so that now the values appear in their native form, namely as the number of seconds since 1/1/1970.  Again the convert clause is not doing anything here either. &lt;/P&gt;

&lt;P&gt;I think what you want is more like: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="solaris3-web-access" /XXYYZZ/ status="200" | timechart count(status) as Logins | convert timeformat="%H:%M:%S" ctime(_time) as Hours&lt;/CODE&gt; | table Hours, Logins`&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2011 20:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34467#M7431</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-06-24T20:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Wierd results with rename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34468#M7432</link>
      <description>&lt;P&gt;I think the field name &lt;CODE&gt;_time&lt;/CODE&gt; tells Splunk to make it human readable, so renaming it removes that built-in functionality. This might work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="solaris3-web-access" /uhpo/ status="200" | 
convert timeformat="%H:%M:%S" ctime(_time) as timestr| 
timechart first(timestr) as hours,count as Logins 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Jon&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2011 20:13:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34468#M7432</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2011-06-24T20:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Wierd results with rename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34469#M7433</link>
      <description>&lt;P&gt;Try fieldformat:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
... | fieldformat Hours=strftime(_time, "%H:%M:%S")&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/Fieldformat"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/Fieldformat&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2015 20:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34469#M7433</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-02T20:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Wierd results with rename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34470#M7434</link>
      <description>&lt;P&gt;Hi kmattern &lt;BR /&gt;
Try this search code &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="solaris3-web-access" /uhpo/ status="200" |timechart count(status) as Logins|appendcols[search sourcetype="solaris3-web-access" /uhpo/ status="200" | convert timeformat="%H:%M:%S" ctime(_time) as timestr|eval n=substr(timestr, 1, 8) ]|rename n as Hours| table Hours Logins 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 May 2015 21:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wierd-results-with-rename/m-p/34470#M7434</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-05-02T21:15:09Z</dc:date>
    </item>
  </channel>
</rss>

