Enhanced Security Measures in Place:   To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.

Log forwarding profile in all security policies

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Log forwarding profile in all security policies

L2 Linker

Is there any other way to configure Log forwarding profile in all 300+ security policies in single shot.

 

currently there is no log forwarding profile in all 300+ policies.

 

 

So below method is not applicable:

 

Not through web interface but you can export config out.

It is one single xml file.

 

Device > Setup > Operations > Export configuration version

Pick latest one from dropdown and click ok.

 

Then open this xml in your favourite text editor.

 

Find area between:

<rule base>

<security>

<rules>

and

</rules>

</security>

 

 

 Everywhere you see "</entry>" and log-setting config does not precede:

Then replace this with:

<log-setting>Log-Forwarding-Policy</log-setting>

</entry>

 

1 accepted solution

Accepted Solutions

L7 Applicator

Other possibilities:

  • Script that first gets all existing rules and you then set the log forwarding profile with a foreach-loop in all existing rules
  • Issue the cli command "set cli config-output-format set", go into config mode, show the security rulebase and include match statement like source zone. This will show you a list with your rules which you can copy to a text editor to replace all source zone parts with "log-setting LOGFORWADRINGPROFILENAME". And finally paste all these commands into the cli and commit

@Javith_Ali it's now up to you which way to go...

View solution in original post

11 REPLIES 11

Cyber Elite
Cyber Elite

@Javith_Ali,

Is there a specific reason why you can't export the XML and modify it manually? That would be a fairly logical conclussion for what you are looking to do, and would honestly take the least amount of time. This is something you could script, but you would need to collect all of the security policy names to actually write that script. 

L7 Applicator

Other possibilities:

  • Script that first gets all existing rules and you then set the log forwarding profile with a foreach-loop in all existing rules
  • Issue the cli command "set cli config-output-format set", go into config mode, show the security rulebase and include match statement like source zone. This will show you a list with your rules which you can copy to a text editor to replace all source zone parts with "log-setting LOGFORWADRINGPROFILENAME". And finally paste all these commands into the cli and commit

@Javith_Ali it's now up to you which way to go...

This link might give you some hints.

In your case you need to get list of rules like @Remo menioned and go from there.

https://live.paloaltonetworks.com/t5/General-Topics/Changing-Profiles-assigned-to-security-Rule/m-p/...

Enterprise Architect, Security @ Cloud Carib Ltd
Palo Alto Networks certified from 2011

L2 Linker

Another option would be to dump config in "set format" to see the actual cli command. I suggest adding the log forward option to at least 1 policy so you have a reference cli command. Then you can sve this as a csv file. Then sort the relevant data and delete everything else. Then add the missing syntax. Then convert the csv back to text and paste as cli. But PAN script mode gets flaky if you paste more than 50 lines at a time. I wish they would fix that. This is why they like to merge portions of the xml file because script mode is unreliable for large pastes.

 

 

Haven't seen this answer yet so needed to reply..

 

Migration Tool!!!    (or Expedition as it's called now) 

 

This is one of the best things about the tool - batch rule changes.

 

Setting Security Profiles on all rules, Log Forwarding, etc

 

Connect the FW (or Panorama) to the Migration Tool, ingest policies, multi-rule edit, then API push the rules back to Firewall.

Validate policies.

 

Commit!

 

c

L0 Member

the pan-c tool will also allow you to do this.

 

https://github.com/cpainchaud/pan-configurator

 

Use the rules-edit function to update all your rules with the new log profile.

 

L2 Linker

FYI, if you name the profile "default" all new security rules will apply the profile automatically.  Same goes for security profile groups

For big pastes to CLI, use a terminal emmulator, like Secure CRT, that allows you to add a 'pause' between lines. I've used a pause of 50ms to paste several hundred lines at a time.

L2 Linker

I realize this is an old post but I have been doing this for several years using the PAN Expedition tool. None of the ASAs have IPS/IDS so it was something I had to do for almost every conversion.

Community Team Member

Hi @SteveKrall ,

 

Thanks for refreshing this topic !

As a reminder I'd like to point out that starting with PAN-OS 10.2 you can add Log Forwarding Profiles in bulk using the policy optimizer:

 

kiwi_0-1673511148017.png

 

I'm sure this is huge improvement for many users wanting to make these kind of bulk changes.

 

Kind regards,

-Kiwi.

 
LIVEcommunity team member, CISSP
Cheers,
Kiwi
Please help out other users and “Accept as Solution” if a post helps solve your problem !

Read more about how and why to accept solutions.

thx, this is exactly what should have been in OS from the beginning!

  • 1 accepted solution
  • 16883 Views
  • 11 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!