<?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: why my eval strptime(substr()) field is not created ? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527056#M88890</link>
    <description>&lt;P&gt;What I have just notice is that all values of each field appear twice :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603966955419.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11574i55CAE27BF3DA7487/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603966955419.png" alt="mah_0-1603966955419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;my props :&amp;nbsp;&lt;/P&gt;&lt;P&gt;[B]&lt;BR /&gt;SHOULD_LINEMERGE = 0&lt;BR /&gt;category = Splunk App Add-on Builder&lt;BR /&gt;pulldown_type = 1&lt;BR /&gt;INDEXED_EXTRACTIONS = json&lt;BR /&gt;TIME_PREFIX = Horodate&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2020 10:29:55 GMT</pubDate>
    <dc:creator>mah</dc:creator>
    <dc:date>2020-10-29T10:29:55Z</dc:date>
    <item>
      <title>why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527035#M88885</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a search like this :&lt;/P&gt;&lt;P&gt;index="test" sourcetype="B"&lt;BR /&gt;| dedup Id&lt;BR /&gt;| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")&lt;BR /&gt;| fieldformat horodate=strftime(horodate,"%Y-%m-%d")&lt;BR /&gt;| stats count(eval(Statut=="OK")) as OK count(eval(Statut=="KO")) as KO count(Statut) as TOTAL by horodate&lt;BR /&gt;&lt;BR /&gt;This search works good with time picker "last 24h" :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_3-1603962754559.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11567iA0D7A55E745368A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_3-1603962754559.png" alt="mah_3-1603962754559.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but not with the time picker "Today" : it returns "no results found" whereas I have 3 events ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_4-1603962886700.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11568i97E820A9A0431571/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_4-1603962886700.png" alt="mah_4-1603962886700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_1-1603962548398.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11565i648ADE5D1D605021/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_1-1603962548398.png" alt="mah_1-1603962548398.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I found that the&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_2-1603962684423.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11566i82EC234BB672EBC6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_2-1603962684423.png" alt="mah_2-1603962684423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;can you help me please ?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527035#M88885</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T09:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527036#M88886</link>
      <description>&lt;P&gt;How many Statut fields do you have in interesting fields and what are their values?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:20:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527036#M88886</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T09:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527039#M88887</link>
      <description>&lt;P&gt;hi&amp;nbsp;&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;just one field Statut and 2 values OK,KO :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603963544292.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11569i9B8C02DE10F85A64/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603963544292.png" alt="mah_0-1603963544292.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527039#M88887</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T09:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527040#M88888</link>
      <description>&lt;P&gt;Sometimes stats has difficulty counting evals&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" sourcetype="B"
| dedup Id
| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")
| fieldformat horodate=strftime(horodate,"%Y-%m-%d")
| eval OK=if(Statut="OK",1,0)
| eval KO=if(Statut="KO",1,0)
| stats sum(OK) as OK sum(KO) as KO count(Statut) as TOTAL by horodate&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:37:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527040#M88888</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T09:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527046#M88889</link>
      <description>&lt;P&gt;hi&amp;nbsp;&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;It doesn't work :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603965215640.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11570iB15DB7126CF10781/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603965215640.png" alt="mah_0-1603965215640.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;more weird, if I remove "by horodate" I get result BUT with nonsense TOTAL :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_1-1603965288640.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11571iD5E04104497AAB4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_1-1603965288640.png" alt="mah_1-1603965288640.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and same issue, when I run:&lt;/P&gt;&lt;P&gt;| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")&lt;BR /&gt;| fieldformat horodate=strftime(horodate,"%Y-%m-%d")&lt;/P&gt;&lt;P&gt;I don't see a field "horodate" in my "Interesting fields":&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_2-1603965352223.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11572i6ADA08D2EEFEED53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_2-1603965352223.png" alt="mah_2-1603965352223.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:56:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527046#M88889</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T09:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527056#M88890</link>
      <description>&lt;P&gt;What I have just notice is that all values of each field appear twice :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603966955419.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11574i55CAE27BF3DA7487/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603966955419.png" alt="mah_0-1603966955419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;my props :&amp;nbsp;&lt;/P&gt;&lt;P&gt;[B]&lt;BR /&gt;SHOULD_LINEMERGE = 0&lt;BR /&gt;category = Splunk App Add-on Builder&lt;BR /&gt;pulldown_type = 1&lt;BR /&gt;INDEXED_EXTRACTIONS = json&lt;BR /&gt;TIME_PREFIX = Horodate&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:29:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527056#M88890</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T10:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527058#M88891</link>
      <description>&lt;P&gt;Try trimming Statut&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" sourcetype="B"
| dedup Id
| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")
| fieldformat horodate=strftime(horodate,"%Y-%m-%d")
| eval Statut=trim(Statut)
| eval OK=if(Statut="OK",1,0)
| eval KO=if(Statut="KO",1,0)
| stats sum(OK) as OK sum(KO) as KO count(Statut) as TOTAL by horodate&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:30:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527058#M88891</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T10:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527063#M88892</link>
      <description>&lt;P&gt;hi&amp;nbsp;&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;I tried with the eval trim :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603968445086.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11575i34EC0C89685ACFD4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603968445086.png" alt="mah_0-1603968445086.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and I removed the "by horodate" , the TOTAL is again nonsense :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_1-1603968494750.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11576i9AEB4DEA4F129AD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_1-1603968494750.png" alt="mah_1-1603968494750.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 10:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527063#M88892</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T10:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527066#M88893</link>
      <description>&lt;P&gt;Try removing empty values from Statut&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" sourcetype="B"
| dedup Id
| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")
| fieldformat horodate=strftime(horodate,"%Y-%m-%d")
| eval Statut=mvfilter(match(Statut,"\S+"))
| eval OK=if(Statut="OK",1,0)
| eval KO=if(Statut="KO",1,0)
| stats sum(OK) as OK sum(KO) as KO count(Statut) as TOTAL by horodate&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 11:09:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527066#M88893</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T11:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527076#M88895</link>
      <description>&lt;P&gt;No still same problem :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603976108605.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11579iB0A7819E07E40005/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603976108605.png" alt="mah_0-1603976108605.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the thing you have to understand is that the problem is at this level in the command :&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")&lt;/P&gt;&lt;P&gt;the substr does not work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 12:56:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527076#M88895</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T12:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527085#M88901</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/222120"&gt;@mah&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that Statut is a multi-value field, perhaps the same is true for Horodate. Please try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" sourcetype="B"
| dedup Id
| stats count(Horodate)&lt;/LI-CODE&gt;&lt;P&gt;Also, you could try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="test" sourcetype="B"
| dedup Id
| eval Horodate=mvfilter(match(Horodate,"\S+"))
| eval Horodate=trim(Horodate)
| eval horodate=strptime(substr(Horodate,1,10),"%Y-%m-%d")
| fieldformat horodate=strftime(horodate,"%Y-%m-%d")
| eval Statut=mvfilter(match(Statut,"\S+"))
| eval OK=if(Statut="OK",1,0)
| eval KO=if(Statut="KO",1,0)
| stats sum(OK) as OK sum(KO) as KO count(Statut) as TOTAL by horodate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 13:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527085#M88901</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-29T13:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: why my eval strptime(substr()) field is not created ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527093#M88904</link>
      <description>&lt;P&gt;Yes, It is as I said : all values in all fields was twice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I added on the search head an app with the sourcetype "B" with le parameter&amp;nbsp;KV_MODE = none :&lt;/P&gt;&lt;P&gt;[B]&lt;/P&gt;&lt;P&gt;KV_MODE = none&lt;/P&gt;&lt;P&gt;and all values appear one time only :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603978987208.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11580iBD06C061DD1C45ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603978987208.png" alt="mah_0-1603978987208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And finally my beginning query works well !&lt;/P&gt;&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 13:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/why-my-eval-strptime-substr-field-is-not-created/m-p/527093#M88904</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T13:44:18Z</dc:date>
    </item>
  </channel>
</rss>

