<?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 Join two datasets and count how many times a host appears, even if zero in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225354#M8162</link>
    <description>&lt;P&gt;Let's say I have a dataset with list of hostnames, for ex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cphost cpcluster_name cphost_role&lt;BR /&gt;one.example.com Test Subscriber&lt;BR /&gt;two.example.com Test Subscriber&lt;BR /&gt;three.example.com Test Subscriber&lt;BR /&gt;four.example.com Test Subscriber&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And another dataset with RADIUS auth logs, for example&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;_raw_log&lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:one.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,65 CPPM_Dashboard_Summary 38932186 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:17:57.076+00,write_timestamp=2025-04-01 16:17:58.899283+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:one.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,78 CPPM_Dashboard_Summary 38932506 1 0 session_id=--,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:15.564+00,write_timestamp=2025-04-01 16:18:16.022775+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:two.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,79 CPPM_Dashboard_Summary 38932516 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:16.294+00,write_timestamp=2025-04-01 16:18:18.058162+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:three.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,80 CPPM_Dashboard_Summary 38932551 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:18.329+00,write_timestamp=2025-04-01 16:18:20.146301+00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I want to join and count the total number of auths for each cphost. So the output would look like this with the data above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;BR /&gt;four.example.com 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know something like this will provide a count of cphosts that show up in the logs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset = prod_dpa_syslog_raw &lt;BR /&gt;| filter _raw_log contains "syslog_clearpass*login*Free-WiFi*login_status*ACCEPT"&lt;BR /&gt;| alter cphost = arrayindex(regextract(_raw_log, "hostname:(\S+)"), 0)&lt;BR /&gt;| comp count() by cphost as total auths&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I also want to display cphosts that have zero auths. What is a good approach of accomplishing that? I've been messing around with "join" but haven't been able to come up with a good solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example I tried:&lt;/P&gt;
&lt;P&gt;dataset = prod_dpa_syslog_raw &lt;BR /&gt;| filter _raw_log contains "syslog_clearpass*login*Free-WiFi*login_status*ACCEPT"&lt;BR /&gt;| alter cphost = arrayindex(regextract(_raw_log, "hostname:(\S+)"), 0)&lt;BR /&gt;| join type = left (dataset = cphost_cluster_role) as role role.cphost = cphost&lt;BR /&gt;| comp count() as TotalAccepts by cphost&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that just ends up providing total count of all and no cphost breakdown&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;totalaccepts cphost&lt;BR /&gt;4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions on how to get the output to look something like this?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;BR /&gt;four.example.com 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-PRODUCT title="Cortex XDR" id="Cortex_XDR"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2025 16:53:32 GMT</pubDate>
    <dc:creator>CesarSaucedo</dc:creator>
    <dc:date>2025-04-01T16:53:32Z</dc:date>
    <item>
      <title>Join two datasets and count how many times a host appears, even if zero</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225354#M8162</link>
      <description>&lt;P&gt;Let's say I have a dataset with list of hostnames, for ex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cphost cpcluster_name cphost_role&lt;BR /&gt;one.example.com Test Subscriber&lt;BR /&gt;two.example.com Test Subscriber&lt;BR /&gt;three.example.com Test Subscriber&lt;BR /&gt;four.example.com Test Subscriber&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And another dataset with RADIUS auth logs, for example&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;_raw_log&lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:one.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,65 CPPM_Dashboard_Summary 38932186 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:17:57.076+00,write_timestamp=2025-04-01 16:17:58.899283+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:one.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,78 CPPM_Dashboard_Summary 38932506 1 0 session_id=--,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:15.564+00,write_timestamp=2025-04-01 16:18:16.022775+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:two.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,79 CPPM_Dashboard_Summary 38932516 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:16.294+00,write_timestamp=2025-04-01 16:18:18.058162+00 &lt;BR /&gt;"sourcetype":"syslog_clearpass" "host":"" hostname:three.example.com &amp;lt;135&amp;gt;2025-04-01 16:19:41,80 CPPM_Dashboard_Summary 38932551 1 0 session_id=,req_source=RADIUS,user_name=,service_name=Free-WiFi -MAC-Auth - Service,alerts_present=0,nas_ip=,nas_port=0,conn_status=Unknown,login_status=ACCEPT,error_code=0,mac_address=,timestamp=2025-04-01 16:18:18.329+00,write_timestamp=2025-04-01 16:18:20.146301+00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I want to join and count the total number of auths for each cphost. So the output would look like this with the data above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;BR /&gt;four.example.com 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know something like this will provide a count of cphosts that show up in the logs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset = prod_dpa_syslog_raw &lt;BR /&gt;| filter _raw_log contains "syslog_clearpass*login*Free-WiFi*login_status*ACCEPT"&lt;BR /&gt;| alter cphost = arrayindex(regextract(_raw_log, "hostname:(\S+)"), 0)&lt;BR /&gt;| comp count() by cphost as total auths&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I also want to display cphosts that have zero auths. What is a good approach of accomplishing that? I've been messing around with "join" but haven't been able to come up with a good solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example I tried:&lt;/P&gt;
&lt;P&gt;dataset = prod_dpa_syslog_raw &lt;BR /&gt;| filter _raw_log contains "syslog_clearpass*login*Free-WiFi*login_status*ACCEPT"&lt;BR /&gt;| alter cphost = arrayindex(regextract(_raw_log, "hostname:(\S+)"), 0)&lt;BR /&gt;| join type = left (dataset = cphost_cluster_role) as role role.cphost = cphost&lt;BR /&gt;| comp count() as TotalAccepts by cphost&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that just ends up providing total count of all and no cphost breakdown&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;totalaccepts cphost&lt;BR /&gt;4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions on how to get the output to look something like this?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;cphost total_auths&lt;BR /&gt;one.example.com 2&lt;BR /&gt;two.example.com 1&lt;BR /&gt;three.example.com 1&lt;BR /&gt;four.example.com 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-PRODUCT title="Cortex XDR" id="Cortex_XDR"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 16:53:32 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225354#M8162</guid>
      <dc:creator>CesarSaucedo</dc:creator>
      <dc:date>2025-04-01T16:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets and count how many times a host appears, even if zero</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225473#M8170</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/803155551"&gt;@CesarSaucedo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem]"&gt;To achieve this, perform a left join between the &lt;CODE data-start="49" data-end="70"&gt;cphost_cluster_role&lt;/CODE&gt; dataset and the aggregated authentication counts from the &lt;CODE data-start="129" data-end="150"&gt;prod_dpa_syslog_raw&lt;/CODE&gt; dataset.&lt;/SPAN&gt; Here's a conceptual query:&lt;/P&gt;
&lt;P&gt;dataset = cphost_cluster_role&lt;BR /&gt;| fields cphost&lt;BR /&gt;| join type = left (&lt;BR /&gt;dataset = prod_dpa_syslog_raw&lt;BR /&gt;| filter _raw_log contains "syslog_clearpass*login*Free-WiFi*login_status*ACCEPT"&lt;BR /&gt;| alter cphost = arrayindex(regextract(_raw_log, "hostname:(\S+)"), 0)&lt;BR /&gt;| comp count() as total_auths by cphost&lt;BR /&gt;) as auth_counts on cphost = auth_counts.cphost&lt;BR /&gt;| alter total_auths = coalesce(auth_counts.total_auths, 0)&lt;BR /&gt;| fields cphost, total_auths&lt;BR /&gt;| sort asc cphost&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you feel this has answered your query, please let us know by clicking like and&amp;nbsp; on "mark this as a Solution". Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 16:16:24 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225473#M8170</guid>
      <dc:creator>aspatil</dc:creator>
      <dc:date>2025-04-02T16:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets and count how many times a host appears, even if zero</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225488#M8174</link>
      <description>&lt;P&gt;Thank you, I was able to get it working with your suggestions.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 19:02:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/join-two-datasets-and-count-how-many-times-a-host-appears-even/m-p/1225488#M8174</guid>
      <dc:creator>CesarSaucedo</dc:creator>
      <dc:date>2025-04-02T19:02:18Z</dc:date>
    </item>
  </channel>
</rss>

