<?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 Automation / API - Register and de-register devices to log-collector group in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593651#M118158</link>
    <description>&lt;P&gt;I am looking for a way to automatically register and de-register a newly created firewall to a specific log-collector group. I had hoped to achieve this with &lt;A href="https://github.com/PaloAltoNetworks/pan-os-python" target="_blank"&gt;https://github.com/PaloAltoNetworks/pan-os-python&lt;/A&gt; but I struggle translating the xml path to work with the op() method.&lt;/P&gt;
&lt;P&gt;While running "set log-collector-group collector-group logfwd-setting devices &amp;lt;device-sn&amp;gt; collectors &amp;lt;collector-sn&amp;gt;" I get the following path:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;request cmd="set" obj="/config/devices/entry[@name='localhost.localdomain']/log-collector-group/entry[@name='collector-group']/logfwd-setting/devices/entry[@name='DEVICE-SN']/collectors" cookie="1234567890000000"&amp;gt;&amp;lt;entry name='COLLECTOR-SN'/&amp;gt;&amp;lt;/request&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;But how do I translate that to something that works with the op() method?&lt;BR /&gt;&lt;BR /&gt;Are there other approaches / solutions that allow automatic registering and de-registering of firewalls to a log collector group?&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2024 14:56:51 GMT</pubDate>
    <dc:creator>Findus</dc:creator>
    <dc:date>2024-07-31T14:56:51Z</dc:date>
    <item>
      <title>Automation / API - Register and de-register devices to log-collector group</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593651#M118158</link>
      <description>&lt;P&gt;I am looking for a way to automatically register and de-register a newly created firewall to a specific log-collector group. I had hoped to achieve this with &lt;A href="https://github.com/PaloAltoNetworks/pan-os-python" target="_blank"&gt;https://github.com/PaloAltoNetworks/pan-os-python&lt;/A&gt; but I struggle translating the xml path to work with the op() method.&lt;/P&gt;
&lt;P&gt;While running "set log-collector-group collector-group logfwd-setting devices &amp;lt;device-sn&amp;gt; collectors &amp;lt;collector-sn&amp;gt;" I get the following path:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;request cmd="set" obj="/config/devices/entry[@name='localhost.localdomain']/log-collector-group/entry[@name='collector-group']/logfwd-setting/devices/entry[@name='DEVICE-SN']/collectors" cookie="1234567890000000"&amp;gt;&amp;lt;entry name='COLLECTOR-SN'/&amp;gt;&amp;lt;/request&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;But how do I translate that to something that works with the op() method?&lt;BR /&gt;&lt;BR /&gt;Are there other approaches / solutions that allow automatic registering and de-registering of firewalls to a log collector group?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 14:56:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593651#M118158</guid>
      <dc:creator>Findus</dc:creator>
      <dc:date>2024-07-31T14:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automation / API - Register and de-register devices to log-collector group</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593672#M118163</link>
      <description>&lt;P&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/523789073"&gt;@Findus&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your research is excellent, as is your use of the "debug cli on" command.&amp;nbsp; Your GitHub link has a link to documentation.&amp;nbsp; If you follow it and click on API Reference &amp;gt; Useful Methods, you will see the list of methods.&amp;nbsp; &lt;A href="https://pandevice.readthedocs.io/en/latest/useful-methods.html#configuration-methods" target="_blank"&gt;https://pandevice.readthedocs.io/en/latest/useful-methods.html#configuration-methods&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would not use the op() method as that is for executing an operational command (think Operational mode &amp;gt; as opposed to Configration mode #).&amp;nbsp; I have not used the Python PAN-OS SDK.&amp;nbsp; So, I am not sure which method to use or if the log collector is supported in the configuration tree for Panorama in the same documentation page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With regard to other approaches, there are LOTS of options.&amp;nbsp; A couple that come to mind are (1) curl command or (2) Python requests module.&amp;nbsp; You would need to be familiar with request types and configuration actions which are passed in the URL.&amp;nbsp; &lt;A href="https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-panorama-api/pan-os-xml-api-request-types/pan-os-xml-api-request-types-and-actions" target="_blank"&gt;https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-panorama-api/pan-os-xml-api-request-types/pan-os-xml-api-request-types-and-actions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A great tool for testing the API is Postman, which is free.&amp;nbsp; &lt;A href="https://www.postman.com/" target="_blank"&gt;https://www.postman.com/&lt;/A&gt;. I use it all the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 16:58:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593672#M118163</guid>
      <dc:creator>TomYoung</dc:creator>
      <dc:date>2024-07-31T16:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automation / API - Register and de-register devices to log-collector group</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593750#M118185</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;thank you for your response! I previously had a look at the documentation but could not find an object that would fit "log-collector-group" in the &lt;A href="https://pandevice.readthedocs.io/en/latest/configtree.html" target="_blank"&gt;documentation&lt;/A&gt;. At this point I think this simply isn't supported yet. I'll follow your advice and use something else to utilize the xml-api path instead.&lt;/P&gt;
&lt;P&gt;In case anyone else stumbles upon this thread, the path is:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;https://{{panorama}}/api/?type=config&amp;amp;action=set
&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/log-collector-group/entry[@name='{{LC-group-NAME}}']/logfwd-setting/devices&amp;amp;key={{panorama-key}}&amp;amp;element=&amp;lt;entry name="{{newfw}}"&amp;gt;&amp;lt;collectors&amp;gt;
&amp;lt;entry name="{{existingLC}}"/&amp;gt;
&amp;lt;/collectors&amp;gt;&amp;lt;/entry&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;To remove a device the path is the same, but replace the action "set" with "delete".&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 10:35:34 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automation-api-register-and-de-register-devices-to-log-collector/m-p/593750#M118185</guid>
      <dc:creator>Findus</dc:creator>
      <dc:date>2024-08-01T10:35:34Z</dc:date>
    </item>
  </channel>
</rss>

