<?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: PSQL - Show top 20 hit count per gateway in Scripts</title>
    <link>https://community.checkpoint.com/t5/Scripts/PSQL-Show-top-20-hit-count-per-gateway/m-p/261792#M1249</link>
    <description>&lt;P&gt;Excellent!&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2025 19:46:07 GMT</pubDate>
    <dc:creator>the_rock</dc:creator>
    <dc:date>2025-11-04T19:46:07Z</dc:date>
    <item>
      <title>PSQL - Show top 20 hit count per gateway</title>
      <link>https://community.checkpoint.com/t5/Scripts/PSQL-Show-top-20-hit-count-per-gateway/m-p/261665#M1242</link>
      <description>&lt;DIV class=""&gt;
&lt;P style="text-align: center;"&gt;&lt;span class="lia-unicode-emoji" title=":trophy:"&gt;🏆&lt;/span&gt;&amp;nbsp;PSQL wizardry!&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_right:"&gt;👉&lt;/span&gt;&amp;nbsp;Directly queries the management database&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PSQL query to show the top 20 hit count per gateway on a Check Point Security Management (SmartCenter).&lt;BR /&gt;&lt;STRONG&gt;In &lt;U&gt;expert&lt;/U&gt; mode run:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;psql_client monitoring postgres -c "WITH ranked AS (SELECT netobj_name AS gateway, rule_uid, policy_type, SUM(hits) AS total_hits, MAX(end_date) AS last_seen, ROW_NUMBER() OVER (PARTITION BY netobj_name ORDER BY SUM(hits) DESC) AS rn FROM public.hitcount WHERE end_date &amp;gt;= now() - interval '30 days' GROUP BY netobj_name, rule_uid, policy_type) SELECT gateway, rule_uid, policy_type, total_hits, last_seen FROM ranked WHERE rn &amp;lt;= 20 ORDER BY gateway, total_hits DESC;"&lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 03 Nov 2025 06:37:59 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/PSQL-Show-top-20-hit-count-per-gateway/m-p/261665#M1242</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2025-11-03T06:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: PSQL - Show top 20 hit count per gateway</title>
      <link>https://community.checkpoint.com/t5/Scripts/PSQL-Show-top-20-hit-count-per-gateway/m-p/261792#M1249</link>
      <description>&lt;P&gt;Excellent!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 19:46:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/PSQL-Show-top-20-hit-count-per-gateway/m-p/261792#M1249</guid>
      <dc:creator>the_rock</dc:creator>
      <dc:date>2025-11-04T19:46:07Z</dc:date>
    </item>
  </channel>
</rss>

