<?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: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only. in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330580#M61273</link>
    <description>&lt;P&gt;I know you said you got around the issue with single quotes.&lt;/P&gt;

&lt;P&gt;Another question, does your JSON event wrap the integers in double quotes or are they unquoted? For example, &lt;BR /&gt;
&lt;CODE&gt;"metric":"4.17"&lt;/CODE&gt; versus &lt;CODE&gt;"metric":4.17&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2017 11:27:05 GMT</pubDate>
    <dc:creator>rjthibod</dc:creator>
    <dc:date>2017-10-25T11:27:05Z</dc:date>
    <item>
      <title>INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330573#M61266</link>
      <description>&lt;P&gt;I have INDEXED_EXTRACTIONS = json in props.conf.&lt;BR /&gt;
Json data are extracted OK, but ...  All fields are extracted as String data type, even fields with numbers only.&lt;BR /&gt;
I can not do any mathematical operations. &lt;BR /&gt;
Is there any global option to enable extracting as number data type? &lt;/P&gt;

&lt;P&gt;Using 6.6.0 version of Splunk&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 13:59:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330573#M61266</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2017-10-23T13:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330574#M61267</link>
      <description>&lt;P&gt;Are the numbers integers, or do they have any punctuation?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 11:34:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330574#M61267</guid>
      <dc:creator>xavierashe</dc:creator>
      <dc:date>2017-10-24T11:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330575#M61268</link>
      <description>&lt;P&gt;Also, have you tried setting the CHARSET in props.conf?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 11:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330575#M61268</guid>
      <dc:creator>xavierashe</dc:creator>
      <dc:date>2017-10-24T11:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330576#M61269</link>
      <description>&lt;P&gt;ye, all of them are integers&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 12:00:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330576#M61269</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2017-10-24T12:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330577#M61270</link>
      <description>&lt;P&gt;I know you asked how to fix this globally, but figured I'd mention you can fix this at search time:&lt;/P&gt;

&lt;P&gt;search | convert num(fieldtoconvert)&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 12:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330577#M61270</guid>
      <dc:creator>xavierashe</dc:creator>
      <dc:date>2017-10-24T12:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330578#M61271</link>
      <description>&lt;P&gt;singlequotes did the trick...&lt;/P&gt;

&lt;P&gt;| where 'cpu_stats.cpu_usage.total_usage' &amp;lt; 0 = OK&lt;BR /&gt;
| where cpu_stats.cpu_usage.total_usage &amp;lt; 0 = NOK&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330578#M61271</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2020-09-29T16:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330579#M61272</link>
      <description>&lt;P&gt;@Rialf1959, for us to assist you better, can you mock sample data (one or more JSON event) and provide us with the same.&lt;/P&gt;

&lt;P&gt;Most likely I expect that your numeric fields are having leading or trailing spaces or special character. Please verify. If it is space you can try the following &lt;CODE&gt;eval&lt;/CODE&gt; with &lt;CODE&gt;trim()&lt;/CODE&gt;to get rid of spaces.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval YourFieldName=trim(YourFieldName)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm. For further assistance please provide us with sample data (you should mock/anonymize sensitive information before posting the same here).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330579#M61272</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-25T11:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330580#M61273</link>
      <description>&lt;P&gt;I know you said you got around the issue with single quotes.&lt;/P&gt;

&lt;P&gt;Another question, does your JSON event wrap the integers in double quotes or are they unquoted? For example, &lt;BR /&gt;
&lt;CODE&gt;"metric":"4.17"&lt;/CODE&gt; versus &lt;CODE&gt;"metric":4.17&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330580#M61273</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-10-25T11:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330581#M61274</link>
      <description>&lt;P&gt;Without quotes...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"read":"2017-10-25T14:21:57.271720193Z","preread":"2017-10-25T14:21:56.27179597Z","pids_stats":{"current":636},"blkio_stats":{"io_service_bytes_recursive":[{"major":7,"minor":0,"op":"Read","value":75264},{"major":7,"minor":0,"op":"Write","value":270336},{"major":7,"minor":0,"op":"Sync","value":200704},{"major":7,"minor":0,"op":"Async","value":144896},{"major":7,"minor":0,"op":"Total","value":345600},{"major":253,"minor":5,"op":"Read","value":75264},{"major":253,"minor":5,"op":"Write","value":270336},{"major":253,"minor":5,"op":"Sync","value":200704},{"major":253,"minor":5,"op":"Async","value":144896},{"major":253,"minor":5,"op":"Total","value":345600},{"major":253,"minor":22,"op":"Read","value":252715008},{"major":253,"minor":22,"op":"Write","value":442368},{"major":253,"minor":22,"op":"Sync","value":356352},{"major":253,"minor":22,"op":"Async","value":252801024},{"major":253,"minor":22,"op":"Total","value":253157376}],"io_serviced_recursive":[{"major":7,"minor":0,"op":"Read","value":10},{"major":7,"minor":0,"op":"Write","value":66},{"major":7,"minor":0,"op":"Sync","value":49},{"major":7,"minor":0,"op":"Async","value":27},{"major":7,"minor":0,"op":"Total","value":76},{"major":253,"minor":5,"op":"Read","value":10},{"major":253,"minor":5,"op":"Write","value":66},{"major":253,"minor":5,"op":"Sync","value":49},{"major":253,"minor":5,"op":"Async","value":27},{"major":253,"minor":5,"op":"Total","value":76},{"major":253,"minor":22,"op":"Read","value":6154},{"major":253,"minor":22,"op":"Write","value":133},{"major":253,"minor":22,"op":"Sync","value":112},{"major":253,"minor":22,"op":"Async","value":6175},{"major":253,"minor":22,"op":"Total","value":6287}],"io_queue_recursive":[],"io_service_time_recursive":[],"io_wait_time_recursive":[],"io_merged_recursive":[],"io_time_recursive":[],"sectors_recursive":[]},"num_procs":0,"storage_stats":{},"cpu_stats":{"cpu_usage":{"total_usage":188759585845,"percpu_usage":[26804947862,25200091098,22004237991,24984726915,23786726201,23685128621,21764745189,20528981968],"usage_in_kernelmode":19020000000,"usage_in_usermode":158840000000},"system_cpu_usage":154732990610000000,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"precpu_stats":{"cpu_usage":{"total_usage":188758618041,"percpu_usage":[26804852383,25200048481,22004237991,24984541388,23786214859,23684995782,21764745189,20528981968],"usage_in_kernelmode":19020000000,"usage_in_usermode":158840000000},"system_cpu_usage":154732982630000000,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"usage":944427008,"max_usage":1055326208,"stats":{"active_anon":553730048,"active_file":127234048,"cache":255229952,"hierarchical_memory_limit":9223372036854771712,"hierarchical_memsw_limit":9223372036854771712,"inactive_anon":135467008,"inactive_file":127995904,"mapped_file":25931776,"pgfault":3112345,"pgmajfault":356,"pgpgin":1235716,"pgpgout":1123695,"rss":689197056,"rss_huge":404750336,"swap":12288,"total_active_anon":553730048,"total_active_file":127234048,"total_cache":255229952,"total_inactive_anon":135467008,"total_inactive_file":127995904,"total_mapped_file":25931776,"total_pgfault":3112345,"total_pgmajfault":356,"total_pgpgin":1235716,"total_pgpgout":1123695,"total_rss":689197056,"total_rss_huge":404750336,"total_swap":12288,"total_unevictable":0,"unevictable":0},"limit":25112842240},"name":"/message-maker.1.ylis21scj6qta08x58bfobuud","id":"24d81325a31ef73446683f0ee65993290c1b96a781c838516820fcb52e6c674a","networks":{"eth0":{"rx_bytes":3994,"rx_packets":53,"rx_errors":0,"rx_dropped":0,"tx_bytes":648,"tx_packets":8,"tx_errors":0,"tx_dropped":0},"eth1":{"rx_bytes":2676,"rx_packets":34,"rx_errors":0,"rx_dropped":0,"tx_bytes":648,"tx_packets":8,"tx_errors":0,"tx_dropped":0},"eth2":{"rx_bytes":10262957,"rx_packets":19847,"rx_errors":0,"rx_dropped":0,"tx_bytes":3551982,"tx_packets":33360,"tx_errors":0,"tx_dropped":0}}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Still Im not sure how Splunk handle arrays.&lt;BR /&gt;
For example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    percpu_usage":[26804947862,25200091098,22004237991,24984726915,23786726201,23685128621,21764745189,20528981968]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 14:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330581#M61274</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2017-10-25T14:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330582#M61275</link>
      <description>&lt;P&gt;Please watch bellow raw data sample. Values from JSON are without quotes.&lt;/P&gt;

&lt;P&gt;EDIT:&lt;/P&gt;

&lt;P&gt;eval YourFieldName=trim(cpu_stats.cpu_usage.total_usage) - not working&lt;BR /&gt;
eval YourFieldName=trim('cpu_stats.cpu_usage.total_usage') - works OK&lt;/P&gt;

&lt;P&gt;EDIT2:&lt;BR /&gt;
It seems that Splunk does not handle JSON arrays well.&lt;BR /&gt;
Expected vaules in percpu_usage{} should be 26804947862,25200091098,22004237991,24984726915,23786726201,23685128621,21764745189,20528981968,    not percpu_usage{} = 26804947862&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     percpu_usage":[26804947862,25200091098,22004237991,24984726915,23786726201,23685128621,21764745189,20528981968]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330582#M61275</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2020-09-29T16:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXED_EXTRACTIONS = json, fields are extracted as strings, even fields that are numeric only.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330583#M61276</link>
      <description>&lt;P&gt;I found the reference that confirms our observations here: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eval"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eval&lt;/A&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;If the expression references a field name that contains non-alphanumeric characters, it needs to be surrounded by single quotation marks. For example, if the field name is server-1 you specify the field name like this new=count+'server-1'.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Because the JSON field you are referencing has a period, you have to use single quotes. This is only true for eval and where.  Search seems forgiving if the non-alphanumeric character is a period.  &lt;/P&gt;

&lt;P&gt;Now as to the question about the arrays.  Splunk correctly parses these as multivalue fields.  The trick is adding curly braces at the end of the field (and double quotes).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table  "cpu_stats.cpu_usage.percpu_usage{}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use mvexpand() or other multivalue functions now.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 15:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/INDEXED-EXTRACTIONS-json-fields-are-extracted-as-strings-even/m-p/330583#M61276</guid>
      <dc:creator>xavierashe</dc:creator>
      <dc:date>2017-10-25T15:34:16Z</dc:date>
    </item>
  </channel>
</rss>

