<?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: HIT Counts R80.40 in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233647#M70451</link>
    <description>&lt;P&gt;So what ? You need a Win VM at least as all the Dashboard parts only fully work on Win. Concerning you post, you can use &lt;A href="https://support.checkpoint.com/results/sk/sk111162" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk111162: How to reset the &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;to make sure no older data is counted.&lt;/P&gt;
&lt;P&gt;Also see &lt;A href="https://support.checkpoint.com/results/sk/sk135212" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk135212: How to export the rulebase &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt; and &lt;A href="https://support.checkpoint.com/results/sk/sk79300" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk79300: How to correlate a rule from SmartConsole to its corresponding entry in kernel table to see the rule's &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2024 11:09:58 GMT</pubDate>
    <dc:creator>G_W_Albrecht</dc:creator>
    <dc:date>2024-11-25T11:09:58Z</dc:date>
    <item>
      <title>HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162027#M70432</link>
      <description>&lt;P&gt;Hi Experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a client who wants to remove unused rules , one way of doing it is by identify rules with zero hits. Here I have a query.&lt;/P&gt;&lt;P&gt;1. lets say I have set the hit count for 3 months. that means SMS will store the hit count data for 3 months for each rule in the policy. If I had hits on a specific rule in Jan and for the next 3 months that rule was unused. does the hit count reset to zero?&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. is there any other way to identify/ delete unused rule. ?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;SM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 14:56:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162027#M70432</guid>
      <dc:creator>Malik1</dc:creator>
      <dc:date>2022-11-14T14:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162031#M70433</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Log analysis is another way depending on your tooling.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Refer also:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://sc1.checkpoint.com/documents/r80.40/webadminguides/en/cp_r80.40_securitymanagement_adminguide/topics-secmg/analyzing-the-rule-base-hit-count.htm" target="_blank"&gt;https://sc1.checkpoint.com/documents/r80.40/webadminguides/en/cp_r80.40_securitymanagement_adminguide/topics-secmg/analyzing-the-rule-base-hit-count.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 15:21:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162031#M70433</guid>
      <dc:creator>Chris_Atkinson</dc:creator>
      <dc:date>2022-11-14T15:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162044#M70434</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Connect to command line on Security Gateway / each cluster member.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Log in to Clish / Expert mode.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Run the &lt;EM&gt;&lt;STRONG&gt;cpstat blades&lt;/STRONG&gt;&lt;/EM&gt; command.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 15:47:16 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162044#M70434</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2022-11-14T15:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162075#M70435</link>
      <description>&lt;P&gt;I did this for a customer, and used the API command on the management server:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;FROM_DATE=$(date -d "90 days ago" +"%Y-%m-%d")

TO_DATE=$(date +"%Y-%m-%d")

JSON_FILE="firewall_rules.last_90_days.json"

CSV_FILE="firewall_rules.last_90_days.csv"

export MGMT_CLI_FORMAT=json



TOTAL_RULES=$(mgmt_cli -r true show-access-rulebase name Network package Standard limit 1 details-level uid | jq '.total')

mgmt_cli -r true show-access-rulebase name Network package Standard show-hits true hits-settings.from-date ${FROM_DATE} hits-settings.to-date ${TO_DATE} use-object-dictionary true limit ${TOTAL_RULES}  &amp;gt; ${JSON_FILE}



echo '"Rule Number","Source","Destination","VPN","Service","Rule Action","Install On"' |tee ${CSV_FILE}



for rule in $(jq -r '.rulebase[] |

  select(.type=="access-rule"), select(.type=="access-section").rulebase[] |

  select(.enabled) |

  select(.hits.value == 0)."rule-number"|@text' ${JSON_FILE})

do



jq --arg rule $rule '( [ ."objects-dictionary"[] | { key:.uid, value:.name  } ] | from_entries ) as $objs |

  .rulebase[]| select(.type=="access-rule"),select(.type=="access-section").rulebase[] |

  select((."rule-number"|@text)==$rule) |

   [ ( [ ."rule-number"|@text ]|@csv ),

     ( [ $objs[."source"[]] ]|@csv),

     ( [$objs[."destination"[]] ]|@csv),

     ( [ $objs[."vpn"[]] ]|@csv ),

     ( [ $objs[."service"[]] ]|@csv ),

     ( [ $objs[."action"] ]|@csv ),

     ( [ $objs[."install-on"[] ] ]|@csv )

   ] |@csv

' &amp;lt; ${JSON_FILE}

done |\

sed -e 's@\\"\\"@@g' -e 's@\\"@"@g' -e 's/^""/"/g' -e 's/""$/"/g' |tee -a ${CSV_FILE}

echo
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The CSV file has a list of the rules with zero hits. &amp;nbsp;Use however you wish. &amp;nbsp;Adjust numbers in the script however you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# cat firewall_rules.last_90_days.csv&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;"number","source","destination","vpn","service","action","install on"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;"1","obj1,obj2","obj1,obj2","Any","Any","Accept","gateway"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;"28","obj3","obj4","Any","http","Accept","gateway2"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 18:37:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162075#M70435</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2022-11-14T18:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162208#M70436</link>
      <description>&lt;P&gt;Hi Duane,&amp;nbsp;&lt;/P&gt;&lt;P&gt;im new to API , i did a copy/paste of the syntax shared on the smart console command cli&amp;nbsp; and every time it gets crashed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I run this via expert mode. is there any syntax that I have to add.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 11:59:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162208#M70436</guid>
      <dc:creator>Malik1</dc:creator>
      <dc:date>2022-11-16T11:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162211#M70437</link>
      <description>&lt;P&gt;This is a .sh script that should run in expert mode - you have to rename the policy package to your policy package name...&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 12:25:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162211#M70437</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2022-11-16T12:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162212#M70438</link>
      <description>&lt;P&gt;Scripts like that won’t work in the SmartConsole CLI, it has to be done in expert mode.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 12:26:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162212#M70438</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2022-11-16T12:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162213#M70439</link>
      <description>&lt;P&gt;Tried &lt;EM&gt;&lt;STRONG&gt;cpstat blades&lt;/STRONG&gt;&lt;/EM&gt; yet ?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 12:29:41 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162213#M70439</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2022-11-16T12:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162235#M70440</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This gives the rules with top hits . what I need is the rules with zero hits.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 426px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/18428iD541EB50AD80A704/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 14:21:34 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162235#M70440</guid>
      <dc:creator>Malik1</dc:creator>
      <dc:date>2022-11-16T14:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162238#M70441</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can u help me or guide how to run such scripts&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 14:25:50 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162238#M70441</guid>
      <dc:creator>Malik1</dc:creator>
      <dc:date>2022-11-16T14:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162243#M70442</link>
      <description>&lt;P&gt;Find some possibilities to see it here:&amp;nbsp;&lt;A class="cp_link sc_ellipsis" href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk85780&amp;amp;partition=Advanced&amp;amp;product=Other" target="_blank"&gt;sk85780: How to use the 'connstat' utility&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 14:38:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162243#M70442</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2022-11-16T14:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162246#M70443</link>
      <description>&lt;P&gt;It is generally expected that, when using expert mode (including for running scripts), that the administrator has some basic Linux/Unix knowledge.&lt;/P&gt;
&lt;P&gt;Versus copy/pasting a script, you&amp;nbsp;might try a pre-built script that largely accomplishes the same thing:&amp;nbsp;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion/Disable-Delete-Rules-with-a-Zero-Hit-Count-MDS-or-SMS/m-p/40005#M2562" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion/Disable-Delete-Rules-with-a-Zero-Hit-Count-MDS-or-SMS/m-p/40005#M2562&lt;/A&gt;&lt;BR /&gt;After downloading the script to the management station, use chmod 755 to make the script executable (e.g. chmod 755 cleanup-zero-hits.sh).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 15:08:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162246#M70443</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2022-11-16T15:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162313#M70444</link>
      <description>&lt;P&gt;unfortunately this is only for&amp;nbsp;&lt;EM&gt;Windows OS&lt;/EM&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 07:54:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/162313#M70444</guid>
      <dc:creator>Malik1</dc:creator>
      <dc:date>2022-11-17T07:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232709#M70445</link>
      <description>&lt;P&gt;In the below command, you are using the 'Network' name, does it change firewall to firewall , customer to customer?&lt;BR /&gt;Is it static or configurable?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;TOTAL_RULES=$(mgmt_cli -r true show-access-rulebase name Network package Standard limit 1 details-level uid | jq '.total')&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 11:54:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232709#M70445</guid>
      <dc:creator>Pavan9096</dc:creator>
      <dc:date>2024-11-14T11:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232725#M70446</link>
      <description>&lt;P&gt;This is what your policy layer name is. &amp;nbsp;You can make it variable. &amp;nbsp;Likewise for the policy package name. &amp;nbsp;Your policy package may not be called Standard, so this can be variable, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POLICY_LAYER="Whatever_yours_is_called"&lt;/P&gt;
&lt;P&gt;POLICY_PACKAGE="Not So Standard"&lt;/P&gt;
&lt;PRE&gt;TOTAL_RULES=$(mgmt_cli -r true show-access-rulebase name "${POLICY_LAYER}" package "${POLICY_PACKAGE}" limit 1 details-level uid | jq '.total')&lt;/PRE&gt;
&lt;P&gt;In the mgmt_cli command, be sure it's double-quoted in case your policy layer has spaces in its name.&lt;/P&gt;
&lt;P&gt;With the variable policy layer name, you can also use that to search the Application layer, if your app control rules are in a separate policy. &amp;nbsp;Likewise, if you have any nested policy layers, just change the name of that variable to get only the rules of that nested policy.&lt;/P&gt;
&lt;P&gt;The main security policy is now "just another layer", albeit the top-level ordered layer.&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 13:58:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232725#M70446</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2024-11-14T13:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232977#M70447</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/694"&gt;@Duane_Toler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;what command/API would list&amp;nbsp;&amp;nbsp;POLICY_LAYER and POLICY_PACKAGE&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 10:04:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232977#M70447</guid>
      <dc:creator>Pavan9096</dc:creator>
      <dc:date>2024-11-18T10:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232978#M70448</link>
      <description>&lt;P&gt;I'm writing a script that should run on any of the firewalls irrespective of package/policy names,&amp;nbsp;&lt;BR /&gt;I want to collect the hit count(last/first hit) of all security-rule from all checkpoint firewalls in my network.&lt;BR /&gt;so I would run the first API from which I will get the policy-layer and package name and will pass it to the below command :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;mgmt_cli -r &lt;SPAN class=""&gt;true&lt;/SPAN&gt; show access-rulebase name {&lt;SPAN&gt;POLICY_LAYER}&lt;/SPAN&gt; details-level {&lt;SPAN&gt;POLICY_PACKAGE}&lt;/SPAN&gt; use-object-dictionary &lt;SPAN class=""&gt;false&lt;/SPAN&gt; show-hits &lt;SPAN class=""&gt;true&lt;/SPAN&gt; --format json &amp;gt; rulebase_output.json&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 10:09:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/232978#M70448</guid>
      <dc:creator>Pavan9096</dc:creator>
      <dc:date>2024-11-18T10:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233027#M70449</link>
      <description>&lt;P&gt;One option is to set those variables on your own manually. &amp;nbsp;Keep in mind a few things:&lt;/P&gt;
&lt;P&gt;1) You can't pull hit counts for a given rule on a given gateway; the hit counts are aggregated from all gateways on which the rule is installed.&lt;/P&gt;
&lt;P&gt;2) You don't pull rules from a given gateway; they're stored on the management server and applied to the gateway(s) based on the policy targets and the Install On column.&lt;/P&gt;
&lt;P&gt;3) You can't get the first-hit date of a rule nor the last-hit date; these are aggregates from a window of time you specify in the show-access-rulebase command.&lt;/P&gt;
&lt;P&gt;4) These API commands are ran against the management server (or management domain for MDS), not a gateway&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get all policy packages on the management server, you use the "show-packages" API command.&lt;/P&gt;
&lt;P&gt;To pull all policy layers, you use the "show-access-layers" API command.&lt;/P&gt;
&lt;P&gt;Use the show-access-rulebase API to pull the entire rulebase of the policy layer and with an optional package argument.&lt;/P&gt;
&lt;P&gt;If you want to craft your own sequences, you should review the management API command reference for your management server's version (and Jumbo HFA level!):&amp;nbsp;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#introduction~v1.9.1%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#introduction~v1.9.1%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can do all of this at the command line in Bash (and I've done it), but you'll need to have plenty of shell scripting skills to do so. &amp;nbsp;Depending on the size of your top level policy layer and sub-layers, pulling all the rules and hit counts may be an intense operation and should be done wisely. &amp;nbsp;If you have 5,000 rules, you may not want to pull all 5,000 rules in one operation (and I think the API server may not allow that much in one task). &amp;nbsp;You can page through the rules in chunks, but you will have to write your own page-management loop to account for the various page chunks. &amp;nbsp;Again, tread cautiously, wisely, and judiciously depending on your configuration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very lightly tested, and not at all verified, but this might get you started:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# Set an array for the packages
declare -a policy_packages

# List of policy packages (hopefully no spaces in your package names)
policy_packages=$(mgmt_cli -r true show-packages |jq -r '.packages[].name')

# Loop through the policy packages
for package in ${policy_packages[@]}; do
  echo "Policy package: ${package}"
  # Get list of policy layers, replace spaces in policy layer names with 0xFF so Bash can tolerate
  for layer in $(mgmt_cli -r true show-access-layers|jq -r '."access-layers"[].name'|sed -e 's/ /\xff/g'); do
    # Replace 0xFF with spaces again
    policy_layer=$(echo $layer|sed -e 's/\xff/ /g')
    echo "  Policy layer: $policy_layer"

    # Fetch rulebase of policy layer in the package and get total rule count
    mgmt_cli -r true show-access-rulebase name "${policy_layer}" package ${package} limit 1 |jq -r '.total'
        # From here you can page through the rules in chunks to get the hit-counts in the layer
    done
done
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 16:09:28 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233027#M70449</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2024-11-18T16:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233643#M70450</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;So, just to clarify, I need to run this APIs on the management server, not the gateway. If I happen to run it on the gateway, would it return the last hit results for only the local gateway or all gateways? Or will it not return anything or error out?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;"mgmt_cli -r true show packages details-level full -f json" --- &amp;gt;&amp;gt; i will run this and will collect the Layer name and package name and will it in following API.&lt;BR /&gt;"mgmt_cli -r true show-access-rulebase name "{POLICY_LAYER}" package "{POLICY_PACKAGE}" show-hits true"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 10:26:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233643#M70450</guid>
      <dc:creator>Pavan9096</dc:creator>
      <dc:date>2024-11-25T10:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: HIT Counts R80.40</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233647#M70451</link>
      <description>&lt;P&gt;So what ? You need a Win VM at least as all the Dashboard parts only fully work on Win. Concerning you post, you can use &lt;A href="https://support.checkpoint.com/results/sk/sk111162" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk111162: How to reset the &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;to make sure no older data is counted.&lt;/P&gt;
&lt;P&gt;Also see &lt;A href="https://support.checkpoint.com/results/sk/sk135212" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk135212: How to export the rulebase &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt; and &lt;A href="https://support.checkpoint.com/results/sk/sk79300" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;sk79300: How to correlate a rule from SmartConsole to its corresponding entry in kernel table to see the rule's &lt;STRONG&gt;Hit&lt;/STRONG&gt; &lt;STRONG&gt;Count&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 11:09:58 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/HIT-Counts-R80-40/m-p/233647#M70451</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2024-11-25T11:09:58Z</dc:date>
    </item>
  </channel>
</rss>

