<?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: XQL Query to Help Create Correlations Rules in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/582249#M6442</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/351591761"&gt;@Fadli_T&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out on LiveCommunity!&lt;/P&gt;
&lt;P&gt;This is happening because in your final query the filter is getting checked against individual datasets not a combination of 3. In order to combine datasets you need to use 'join' stage. But it can join two datasets at a time. Below is the reference document for join stage.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/Join" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/Join&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way why are you creating four different datasets since all are made from same dataset.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 15:37:45 GMT</pubDate>
    <dc:creator>nsinghvirk</dc:creator>
    <dc:date>2024-04-01T15:37:45Z</dc:date>
    <item>
      <title>XQL Query to Help Create Correlations Rules</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/581983#M6428</link>
      <description>&lt;P&gt;Hello i'm trying to do query for the specific fields in the datasets, im trying to do regextract to filter out some specific value in the fields then i use alter to move it to the new fields. But the problem is the value of the fields that im trying to query is appear in the different event. Here's the query that i already make:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATASET 1: create dataset named “verdict” to store new field named MID and Verdict&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = unknown_unknown_raw |
sort desc _raw_log |
filter _raw_log contains "verdict negative" |
alter MID = regextract(_raw_log , "MID\s(\d+)") |
alter Verdict = regextract(_raw_log, "verdict negative") | 
target type = dataset verdict&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATASET2: create dataset named “src” to store a new field named source&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = unknown_unknown_raw |
sort desc _raw_log |
filter _raw_log contains "ICID" and _raw_log contains "From" and _raw_log contains "@" |
alter source = regextract(_raw_log, "From:\s&amp;lt;([^&amp;gt;]+)&amp;gt;") &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATASET3: create dataset named “dst” to store a new field named destination&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = unknown_unknown_raw |
sort desc _raw_log |
filter _raw_log contains "ICID" and _raw_log contains "To" and _raw_log contains "@" and _raw_log not contains "From" |
alter destination = regextract(_raw_log, "To:\s&amp;lt;([^&amp;gt;]+)&amp;gt;") |
target type = dataset dst&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then after making all the fields, i try to query the new dataset which contains the fields i need that i already regex with this command:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset in (verdict, src, dst) |
filter verdict != null or MID != null or source != null or destination != null&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it only return only 2 fields with value, like:&lt;BR /&gt;- MID &amp;amp; verdict&lt;/P&gt;
&lt;P&gt;- MID &amp;amp; source&lt;/P&gt;
&lt;P&gt;- MID &amp;amp; destination&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It happens because verdict, source and destination are in the different event but they can have same MID. But i want to do correlations for that 4 fields. My main goals to make a correlation rules to correlate verdict, source and destination with same MID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any best practice to solve this?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 04:37:31 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/581983#M6428</guid>
      <dc:creator>Fadli_T</dc:creator>
      <dc:date>2024-03-28T04:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: XQL Query to Help Create Correlations Rules</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/582249#M6442</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/351591761"&gt;@Fadli_T&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out on LiveCommunity!&lt;/P&gt;
&lt;P&gt;This is happening because in your final query the filter is getting checked against individual datasets not a combination of 3. In order to combine datasets you need to use 'join' stage. But it can join two datasets at a time. Below is the reference document for join stage.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/Join" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/Cortex-XDR-XQL-Language-Reference/Join&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way why are you creating four different datasets since all are made from same dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 15:37:45 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/582249#M6442</guid>
      <dc:creator>nsinghvirk</dc:creator>
      <dc:date>2024-04-01T15:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: XQL Query to Help Create Correlations Rules</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/582772#M6464</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/256101"&gt;@nsinghvirk&lt;/a&gt; ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply, i already solve this last query with join as you advised. I do the join for the verdict and src dataset then target it to the new dataset, then merge that new dataset with the dst dataset and finally i can make them in 1 row with the same MID. For the refferences this is my last query:&lt;/P&gt;
&lt;P&gt;JOIN 1: MID + VERDICT + SOURCE&lt;/P&gt;
&lt;P&gt;dataset = verdict | limit 1 | join type = left (dataset = src) as vs (true = true) | sort asc _time&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;| target type = dataset vs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;JOIN 2: MID + VERDICT + SOURCE + DESTINATION&lt;/P&gt;
&lt;P&gt;dataset = vs | limit 1 | join type = left (dataset = dst) as sd (true = true) | sort asc _time | target type = dataset result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QUERY RESULT: Query new dataset named “result” with 4 fields that i desire in 1 row&lt;/P&gt;
&lt;P&gt;dataset = result | fields MID, Verdict, source , destination&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 09:17:32 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-help-create-correlations-rules/m-p/582772#M6464</guid>
      <dc:creator>Fadli_T</dc:creator>
      <dc:date>2024-04-05T09:17:32Z</dc:date>
    </item>
  </channel>
</rss>

