<?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: host inventory - Disk Space XQL - bytes conversion not possible because of string - to_number? in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515605#M2863</link>
    <description>&lt;P&gt;Rob,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://docs.paloaltonetworks.com/cortex/cortex-xdr/cortex-xdr-xql-language-reference/xql-functions-reference/functions-reference-to-integer" target="_self"&gt;to_integer()&lt;/A&gt; function available in XQL to convert a string to an integer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;config case_sensitive = false
| dataset = host_inventory
| arrayexpand disks
| alter disks = json_extract(disks, "$.name"), free_space = to_integer(json_extract(disks, "$.free_space")), size = json_extract(disks, "$.size")
| alter free_space_KB = divide(free_space, 1024) // convert bytes to KB
| alter free_space_MB = divide(free_space_KB, 1024) // convert KB to MB
| alter free_space_GB = divide(free_space_MB, 1024) // convert MB to GB
| filter free_space_GB &amp;lt; 5&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tyler&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 13:55:54 GMT</pubDate>
    <dc:creator>tyler_bailey</dc:creator>
    <dc:date>2022-09-21T13:55:54Z</dc:date>
    <item>
      <title>host inventory - Disk Space XQL - bytes conversion not possible because of string - to_number?</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515604#M2862</link>
      <description>&lt;P&gt;Hello dear community,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can we get this use case running? I need to know which disk is running lower than 5 GB.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my case I have a conversion problem, because the field free_space is a string. How can I convert it to a number, so I can divide it to GB?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;config case_sensitive = false&lt;BR /&gt;|dataset = host_inventory&lt;BR /&gt;| arrayexpand disks &lt;BR /&gt;| alter disks = json_extract(disks, "$.name"), free_space = json_extract(disks, "$.free_space"), size = json_extract(disks, "$.size")&lt;/P&gt;
&lt;P&gt;//| alter free_space_KB = divide(free_space, 1024) // convert bytes to KB&lt;BR /&gt;//| alter free_space_MB = divide(free_space_KB, 1024) // convert KB to MB&lt;BR /&gt;//| alter free_space_GB = divide(free_space_MB, 1024) // convert MB to GB&lt;BR /&gt;//|alter total_upload_GB_rounded = round(free_space_GB)&lt;BR /&gt;//| filter applications contains $Software&lt;BR /&gt;&lt;BR /&gt;| fields host_name, disks , free_space, size, ip_addresses&lt;BR /&gt;| sort desc free_space&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also seen, that the fields are all strings and I cannot do any calculations &amp;lt;&amp;gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 13:45:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515604#M2862</guid>
      <dc:creator>RFeyertag</dc:creator>
      <dc:date>2022-09-21T13:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: host inventory - Disk Space XQL - bytes conversion not possible because of string - to_number?</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515605#M2863</link>
      <description>&lt;P&gt;Rob,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://docs.paloaltonetworks.com/cortex/cortex-xdr/cortex-xdr-xql-language-reference/xql-functions-reference/functions-reference-to-integer" target="_self"&gt;to_integer()&lt;/A&gt; function available in XQL to convert a string to an integer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;config case_sensitive = false
| dataset = host_inventory
| arrayexpand disks
| alter disks = json_extract(disks, "$.name"), free_space = to_integer(json_extract(disks, "$.free_space")), size = json_extract(disks, "$.size")
| alter free_space_KB = divide(free_space, 1024) // convert bytes to KB
| alter free_space_MB = divide(free_space_KB, 1024) // convert KB to MB
| alter free_space_GB = divide(free_space_MB, 1024) // convert MB to GB
| filter free_space_GB &amp;lt; 5&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 13:55:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515605#M2863</guid>
      <dc:creator>tyler_bailey</dc:creator>
      <dc:date>2022-09-21T13:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: host inventory - Disk Space XQL - bytes conversion not possible because of string - to_number?</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515607#M2864</link>
      <description>&lt;P&gt;Thank you tyler! I took the wrong datatype :/.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 14:17:42 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/host-inventory-disk-space-xql-bytes-conversion-not-possible/m-p/515607#M2864</guid>
      <dc:creator>RFeyertag</dc:creator>
      <dc:date>2022-09-21T14:17:42Z</dc:date>
    </item>
  </channel>
</rss>

