<?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 do I edit my search to convert a string to a numeric value to display a graph? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215782#M63278</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=DCM_MEAS_XML | chart  _time Measurement.lcp0_shp  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gave me an error message &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;but your gentimes search gave exactly same result than for you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DCM_MEAS_XML | chart values(Measurement.lcp0_shp) by _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search didn't give any visualization for me. Please see the attachment.&lt;BR /&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/1073i03BF1807263D8D3C/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>Tue, 23 Feb 2016 12:05:47 GMT</pubDate>
    <dc:creator>Sr59</dc:creator>
    <dc:date>2016-02-23T12:05:47Z</dc:date>
    <item>
      <title>How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215780#M63276</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I'm indexing XML data containing free memory values and get a nice stats table, but not be able to show that as a graph because Splunk interprets memory values as strings.&lt;BR /&gt;
My event example is attached.&lt;/P&gt;

&lt;P&gt;I tried to convert string to numbers, but didn't succeed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DCM_MEAS_XML | rename Measurement.lcp0_shp as lcp0_shp | eval num=if(isnum(lcp0_shp),"yes","no") |  eval str=if(isstr(lcp0_shp),"yes","no") | Convert num(lcp0_shp) as number | eval converted=if(isnum(number),"yes","no") | stats values(num) values(str) values(converted) values(number) by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gave me following output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                    values(num)   values(str   )values(converted)   values(number)
2016-02-22 19:41:28.359   no            yes        no                 2976716
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample event:&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/1077iD0B3E4B5D1E964A8/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>Tue, 23 Feb 2016 06:35:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215780#M63276</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-23T06:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215781#M63277</link>
      <description>&lt;P&gt;Can you confirm you get no visualisation for the following search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DCM_MEAS_XML | timechart max(Measurement.lcp0_shp) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried to replicate your issue with the following search :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1 | fields - endhuman endtime starthuman | eval lcp0_shp="123456 " |  eval num=if(isnum(lcp0_shp),"yes","no") | eval str=if(isstr(lcp0_shp),"yes","no") | convert num(lcp0_shp) as number | eval converted=if(isnum(number),"yes","no") | stats values(num) values(str) values(converted) values(number) by starttime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it looks perfectly fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;starttime   values(num) values(str) values(converted)   values(number)
1456128000  no            yes                   yes     123456
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you run my gentimes search as well to see if you get the same output? &lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 10:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215781#M63277</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-23T10:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215782#M63278</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=DCM_MEAS_XML | chart  _time Measurement.lcp0_shp  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gave me an error message &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;but your gentimes search gave exactly same result than for you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DCM_MEAS_XML | chart values(Measurement.lcp0_shp) by _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search didn't give any visualization for me. Please see the attachment.&lt;BR /&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/1073i03BF1807263D8D3C/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>Tue, 23 Feb 2016 12:05:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215782#M63278</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-23T12:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215783#M63279</link>
      <description>&lt;P&gt;try  :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DCM_MEAS_XML | rename Measurement.lcp0_shp as lcp0_shp | eval num=if(isnum(lcp0_shp),"yes","no") | eval str=if(isstr(lcp0_shp),"yes","no") | Convert auto(lcp0_shp) as number | eval converted=if(isnum(number),"yes","no") | stats values(num) values(str) values(converted) values(number) by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Feb 2016 14:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215783#M63279</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2016-02-23T14:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215784#M63280</link>
      <description>&lt;P&gt;Sorry I typod the first search. That  should have been a timechart max() can you try it again?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:40:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215784#M63280</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-24T14:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215785#M63281</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;Thanks for your answers. I tried the convert auto option as well but unfortunately it didn't help.&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/1074i1A914C0F9C8186E5/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>Fri, 26 Feb 2016 05:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215785#M63281</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-26T05:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215786#M63282</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;Unfortunately neither this didn't solve my problem.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Hannu&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 06:14:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215786#M63282</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-26T06:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215787#M63283</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I suppose that my problem is that those measurements are not connected to _time which I have tried to use. I suppose I should use Time event and somehow combine measurements to measurement Time to be able to draw a graph. Do you have any proposal how to do it?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Hannu&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 08:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215787#M63283</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-26T08:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215788#M63284</link>
      <description>&lt;P&gt;I notice you're running the search in Fast Mode - have you tried it in Smart Mode instead?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 09:40:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215788#M63284</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-29T09:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215789#M63285</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;Yes I did but same result.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Hannu&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 10:03:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215789#M63285</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-29T10:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215790#M63286</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I changed the file to json format and split it so that one file contains only measurements done in one time value (vs earlier several measurements in one file which was split to separated measurement events in sourcetype).&lt;/P&gt;

&lt;P&gt;Now I'm able to draw a graph using search command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Measurement_meminfo_20160225_132246_264_v2.json" host="ourdsplunk60.emea.nsn-net.net" sourcetype="_json" | rename Measurement{}.Time as mtime | stats last(Measurement{}.lcp0_shp) max(Measurement{}.lcp0_ahp0) max(Measurement{}.lsp0_k2a) max(Measurement{}.lsp0_k2c) max(Measurement{}.lsp0_axm0) max(Measurement{}.lsp0_k2b) by mtime
&lt;/CODE&gt;&lt;/PRE&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/1075iD8B81EAB1FE3764C/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/1076i4D6E07C9B80B4E2E/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;Maybe we need still improve the json file but anyway this is already working. Thanks for your help!&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Hannu&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 10:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215790#M63286</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-29T10:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215791#M63287</link>
      <description>&lt;P&gt;I am flummoxed. I can't see why you get no values. &lt;/P&gt;

&lt;P&gt;Even a straight  &lt;CODE&gt;sourcetype=DCM_MEAS_XML | table  _time Measurement.lcp0_shp&lt;/CODE&gt; should give you a visualisation. Any chance you can post raw data so we can try and replicate the issue?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 10:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215791#M63287</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-29T10:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to convert a string to a numeric value to display a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215792#M63288</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;This looks still the same no visualisation. I found a workaround but it's not yet visible here.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Hannu&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 10:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-convert-a-string-to-a-numeric-value/m-p/215792#M63288</guid>
      <dc:creator>Sr59</dc:creator>
      <dc:date>2016-02-29T10:31:13Z</dc:date>
    </item>
  </channel>
</rss>

