Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Carlos_Arzate
Participant

Hit count R80.10

Good day guys,

 

We have a question is about hit count. Customer told us that if is possible to extract hit count of their policies. We execute some SK's but is not shown. Then I did try with api commands but my tests have not succesfully

Currently we try to execute this command but is not working.

mgmt_cli show access-rulebase offset 0 limit 20 name "Network" details-level "standard" show-hits true hits-settings.target "XXX" --root true --format json | $CPDIR/jq/jq '.rulebase[] | select(.hits.value == 0) | [.rule-number , .name , .comments , .enabled ] | @csv' -r > hits.csv

And when I did execute shown this error
error: number is not defined
.rulebase[] | select(.hits.value == 0) | [.rule-number , .name , .comments , .enabled ] | @csv 1 compile error

Could you help me with this?

3 Replies
PhoneBoy
Admin
Admin

This command has two parts: the mgmt_cli part, and the jq part.
The jq part (which is erroring) won't work if the mgmt_cli output isn't what jq expects.
What's the output of the mgmt_cli part (e.g. everything before the first pipe)?
0 Kudos
Carlos_Arzate
Participant

Hi,

We need to know what is the hit count of each of their rules

0 Kudos
PhoneBoy
Admin
Admin

I understand what you're trying to accomplish.
The command is most likely correct, but you're not referring to the correct policy name in your command.
That would cause the error you're seeing.
However, that's merely a guess.
The real reason for the failure would be apparent if you just ran the mgmt_cli portion of that command (everything before the first pipe: |).

To double-check you are referring to the correct layer (which may not be called Network):
In Security Policies, click the +, then Manage Policies and Layers, then go to Layers > Access Control and make sure you know precisely what layer it is you're trying to get the stats on.
Replace "Network" with whatever that is in your case in the command.

Screen Shot 2020-04-14 at 11.07.53 AM.png

If that doesn't resolve the issue, please paste the precise output you get when you run just the mgmt_cli portion (without piping it to jq).

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events