I created a script a while ago. This is the important part:
Change_Track_Log3.sh
#Default values
Layer_Name="$2 Network"
Domain_Name="$3"
mgmt_cli login -r true > id.txt
for (( N=1; (($N-1))<$1; N=(($N+1)))); { mgmt_cli set access-rule layer "$Layer_Name" rule-number $N track.type log track.per-session true --domain "System Data" -s id.txt; }
mgmt_cli publish -s id.txt
You can run it with syntax:
./Change_Track_Log3.sh 3 amirP
This changed the first 3 rules on amirP policy package to session.
Domain name is for MDS. You can leave blank for non-MDS.
Edited comments:
Please don't take this at face value. This is good in general but might need fine tuning for your needs.
Example: if you have detailed/extended logs on some of your rules.
Also, you can replace the root user (-r true) with actual admin and hold the publish. This way you can review the changes and only then publish.
Kind regards, Amir Senn