<?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 XSOAR getIncidents command in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/540868#M2084</link>
    <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been making great use of custom scripts to extract reporting metrics that wouldn't have been possible with the built in widgets. But something I've noticed recently is that querying incidents seems to be causing huge spikes in CPU and memory usage. Most of my scripts are querying the previous months worth of incidents, which is only ~2000 incidents.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Even though I'm doing some processing (parsing datetimes, iterating over lists and dictionaries), I can't see why it should be so resource hungry. The demand of the script itself should be trivial.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only thing I can think of that might explain the resource drain is executing commands in the scripts. The documentation around that is almost non-existent, but I did find &lt;A href="https://paulbenoit.com/posts/searching-in-xsoar" target="_self"&gt;this blog post&lt;/A&gt;&amp;nbsp;which suggests that if I pass queries to the getIncidents command, it will ignore the from and to date fields and instead query incident across&amp;nbsp;&lt;EM&gt;all time&lt;/EM&gt; which sounds ridiculous, but if true, might explain why my queries are so hungry.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anyone have a good understanding of how the getIncidents command works under the hood?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone had some experience scripting queries that has some pointers about performance?&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 05:52:07 GMT</pubDate>
    <dc:creator>callumbaillie527</dc:creator>
    <dc:date>2023-05-03T05:52:07Z</dc:date>
    <item>
      <title>XSOAR getIncidents command</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/540868#M2084</link>
      <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been making great use of custom scripts to extract reporting metrics that wouldn't have been possible with the built in widgets. But something I've noticed recently is that querying incidents seems to be causing huge spikes in CPU and memory usage. Most of my scripts are querying the previous months worth of incidents, which is only ~2000 incidents.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Even though I'm doing some processing (parsing datetimes, iterating over lists and dictionaries), I can't see why it should be so resource hungry. The demand of the script itself should be trivial.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only thing I can think of that might explain the resource drain is executing commands in the scripts. The documentation around that is almost non-existent, but I did find &lt;A href="https://paulbenoit.com/posts/searching-in-xsoar" target="_self"&gt;this blog post&lt;/A&gt;&amp;nbsp;which suggests that if I pass queries to the getIncidents command, it will ignore the from and to date fields and instead query incident across&amp;nbsp;&lt;EM&gt;all time&lt;/EM&gt; which sounds ridiculous, but if true, might explain why my queries are so hungry.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anyone have a good understanding of how the getIncidents command works under the hood?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone had some experience scripting queries that has some pointers about performance?&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 05:52:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/540868#M2084</guid>
      <dc:creator>callumbaillie527</dc:creator>
      <dc:date>2023-05-03T05:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: XSOAR getIncidents command</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/540932#M2088</link>
      <description>&lt;P&gt;If you aren't specifying a date range in the from date and to date, then it does default to all time.&amp;nbsp; This is likely the cause of the resource consumption particularly if you have more than 12 months of Incident data on your system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you call it, the easiest fix is to tighten your query by adding those arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This OOTB script uses the getIncidents command and has alot of different options:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://xsoar.pan.dev/docs/reference/scripts/search-incidents-summary" target="_blank"&gt;https://xsoar.pan.dev/docs/reference/scripts/search-incidents-summary&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically the getIncidents subscribes to the rules of searching in XSOAR as described here, not sure if there is any better document:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.11/Cortex-XSOAR-Administrator-Guide/How-to-Search" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.11/Cortex-XSOAR-Administrator-Guide/How-to-Search&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 15:54:20 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/540932#M2088</guid>
      <dc:creator>MBeauchamp2</dc:creator>
      <dc:date>2023-05-03T15:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: XSOAR getIncidents command</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/541172#M2094</link>
      <description>&lt;P&gt;Thanks for pointing me toward those other scripts. I'm experimenting with the different options to get an idea on the performance.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 07:18:21 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/xsoar-getincidents-command/m-p/541172#M2094</guid>
      <dc:creator>callumbaillie527</dc:creator>
      <dc:date>2023-05-05T07:18:21Z</dc:date>
    </item>
  </channel>
</rss>

