Adding log forwarding profiles and profile match lists and actions with pan-os-python API

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

Adding log forwarding profiles and profile match lists and actions with pan-os-python API

L1 Bithead

Anyone have any examples of adding log forwarding profiles with match lists and actions using the pan-os-python API?

 

Here's a sample that has me stuck:

 

from panos.panorama import Panorama, DeviceGroup
from panos.objects import LogForwardingProfile,LogForwardingProfileMatchList,LogForwardingProfileMatchListAction
pano = Panorama(hostname='xxx', api_key='api_key-here')
dg = DeviceGroup("Test1")
pano.add(dg)

 

obj=LogForwardingProfile("LFP1")
dg.add(obj)
obj.create()

 

That creates the new log forwarding profile, but then how do I attach the match lists and match list actions to the new profile?

 

 

 

1 accepted solution

Accepted Solutions

L1 Bithead

I figured it out, just took a while for the object hierarchy to sink in:

 

obj=LogForwardingProfile("LFP1")
obj.add(LogForwardingProfileMatchList(name="Rule1",filter="All Logs",log_type="traffic",send_to_panorama="True"))
dg.add(obj)
obj.create()

View solution in original post

1 REPLY 1

L1 Bithead

I figured it out, just took a while for the object hierarchy to sink in:

 

obj=LogForwardingProfile("LFP1")
obj.add(LogForwardingProfileMatchList(name="Rule1",filter="All Logs",log_type="traffic",send_to_panorama="True"))
dg.add(obj)
obj.create()

  • 1 accepted solution
  • 1104 Views
  • 1 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!