<?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 Why does the convert command not work in my search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332078#M98772</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3266i71016293286C4971/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 17:08:40 GMT</pubDate>
    <dc:creator>hjaramillo</dc:creator>
    <dc:date>2017-07-27T17:08:40Z</dc:date>
    <item>
      <title>Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332078#M98772</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3266i71016293286C4971/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332078#M98772</guid>
      <dc:creator>hjaramillo</dc:creator>
      <dc:date>2017-07-27T17:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332079#M98773</link>
      <description>&lt;P&gt;can you paste value of TimeMax.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:21:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332079#M98773</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-07-27T18:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332080#M98774</link>
      <description>&lt;P&gt;The format of TimeMax is "%m/%d/%Y %H:%M:%S" and i need this "%H:%M:%S"&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://docs.splunk.com/images/1/19/ConvertEx2.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:33:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332080#M98774</guid>
      <dc:creator>hjaramillo</dc:creator>
      <dc:date>2017-07-27T18:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332081#M98775</link>
      <description>&lt;P&gt;try like below&lt;BR /&gt;
rest of your search | eval temp=strptime(TimeMax,"%m/%d/%Y %H:%M:%S") | convert timeformat="%H:%M:%S" ctime(temp) AS Hora &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332081#M98775</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-07-27T18:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332082#M98776</link>
      <description>&lt;P&gt;There are several &lt;CODE&gt;performance issues&lt;/CODE&gt; with your current query, besides the issue you have posted here.&lt;/P&gt;

&lt;P&gt;1) Filter results in base query (i.e. before first pipe) :&lt;CODE&gt;where IDVariable="(207011004)"&lt;/CODE&gt; should be removed and moved as filter to base query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch With Index and Sourcetype&amp;gt; IDVariable="(207011004)" | &amp;lt;your remaining query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) You are performing &lt;CODE&gt;reverse&lt;/CODE&gt; and then &lt;CODE&gt;tail 1&lt;/CODE&gt;. You can instead perform a single &lt;CODE&gt;| head 1&lt;/CODE&gt; command.&lt;BR /&gt;
3) Create table after head 1 command.&lt;/P&gt;

&lt;P&gt;Refer to Splunk Documentation on Query optimization for your referenc: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Quicktipsforoptimization"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Quicktipsforoptimization&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Coming to your issue, you should convert string timestamp to epoch using &lt;CODE&gt;strptime()&lt;/CODE&gt; function and then use fieldformat command to use the Display format (String Time) as required while retaining the underlying epoch time value. Following is a run anywhere search:&lt;/P&gt;

&lt;P&gt;| makeresults&lt;BR /&gt;
| eval TimeMax=strptime("04/01/2017 05:34:26","%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| fieldformat TimeMax=strftime(TimeMax,"%H:%M:%S")&lt;/P&gt;

&lt;P&gt;Your query after optimization and fix should look like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sqlserver source=reportesco sourcetype=reportesco IDVariable="(2017011004)"
| head 1
| stats dc(Value) as "OK" values(Value) as "Ultimo Valor 24 hrs" values(TimeMax) as "Hora"
| eval Hora=strptime(Hora,"%m/%d/%Y %H:%M:%S")
| fieldformat Hora=strftime(Hora,"%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out an confirm if it is working as expected.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 19:00:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332082#M98776</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-27T19:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332083#M98777</link>
      <description>&lt;P&gt;Using:&lt;/P&gt;

&lt;P&gt;index=sqlserver source=reportesco sourcetype=reportesco IDVariable="(2017011004)"&lt;BR /&gt;
 | head 1&lt;BR /&gt;
 | stats dc(Value) as "OK" values(Value) as "Ultimo Valor 24 hrs" values(TimeMax) as "Hora"&lt;BR /&gt;
 | eval Hora=strptime(Hora,"%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
 | fieldformat Hora=strftime(Hora,"%H:%M:%S")&lt;/P&gt;

&lt;P&gt;Not results, the tables are empty.&lt;/P&gt;

&lt;P&gt;And&lt;/P&gt;

&lt;P&gt;index=sqlserver source=reportescso sourcetype=reportescso&lt;BR /&gt;
| head 1 &lt;BR /&gt;
| stats dc(Value) as "OK" values(Value) as "Ultimo Valor 24 hrs" values(TimeMax) as "Hora" &lt;BR /&gt;
| eval temp=strptime(TimeMax,"%Y/%m/%d %H:%M:%S") &lt;BR /&gt;
| convert timeformat="%H:%M:%S" ctime(temp) as Hora &lt;BR /&gt;
| fieldformat Hora=strftime(Hora,"%H:%M:%S")&lt;/P&gt;

&lt;P&gt;Missing the value "hour"&lt;/P&gt;

&lt;P&gt;My Splunk is 6.5.3 &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 21:33:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332083#M98777</guid>
      <dc:creator>hjaramillo</dc:creator>
      <dc:date>2017-07-27T21:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332084#M98778</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3264iD22D8E897E4CF5B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3265i3ECF7199C7BFB85D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 21:35:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332084#M98778</guid>
      <dc:creator>hjaramillo</dc:creator>
      <dc:date>2017-07-27T21:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332085#M98779</link>
      <description>&lt;P&gt;It does not give me result of the table "hour"&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 21:45:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332085#M98779</guid>
      <dc:creator>hjaramillo</dc:creator>
      <dc:date>2017-07-27T21:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the convert command not work in my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332086#M98780</link>
      <description>&lt;P&gt;| convert timeformat="%H:%M:%S" ctime(temp) AS Hour&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 23:47:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-convert-command-not-work-in-my-search/m-p/332086#M98780</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-07-27T23:47:51Z</dc:date>
    </item>
  </channel>
</rss>

