<?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 Re: Filter rules with no log forwarding profile configured in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209945#M61345</link>
    <description>&lt;P&gt;this may be useful : &lt;A title="Tips &amp;amp; Tricks: Filtering the security policy" href="https://live.paloaltonetworks.com/t5/Community-Blog/Tips-amp-Tricks-Filtering-the-security-policy/ba-p/163250" target="_blank"&gt;Tips &amp;amp; Tricks: Filtering the security policy&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;log filters look for a positive match in the config file (or a negate of a positive match). values that have not been set can't be searched (in essence, any policy that does not have log forwarding set will not have the attribute in the XML of the config file)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;one exception is when a policy used to have it set, and later was removed, the attribute will remain&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;unfortunately this makes it a little more difficult if you need to look for 'something thats NOT there'&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 09:28:52 GMT</pubDate>
    <dc:creator>reaper</dc:creator>
    <dc:date>2018-04-13T09:28:52Z</dc:date>
    <item>
      <title>Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209823#M61309</link>
      <description>&lt;P&gt;Anybody knows a trick how to filter for rules with no log forwarding profile configured?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(log-setting eq 'Profile-Name') =&amp;gt; all rules with Profile-Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;!(log-setting eq '&lt;/SPAN&gt;&lt;SPAN&gt;Profile-Name&lt;/SPAN&gt;&lt;SPAN&gt;') =&amp;gt; does not work, shows all rules&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(log-setting neq 'Profile-Name') =&amp;gt; does not work, shows&amp;nbsp;no rules&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(log-setting eq none) =&amp;gt; does not work, shows&amp;nbsp;no rules&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:45:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209823#M61309</guid>
      <dc:creator>Anon1</dc:creator>
      <dc:date>2018-04-12T16:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209862#M61318</link>
      <description>&lt;P&gt;(log-setting eq 'Panorama')&amp;nbsp; = Gives me panorama&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(log-setting eq '') = Gives me empty values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'' is also useful&amp;nbsp;in user-id searches as it gives you "empty" user-id log matches&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 18:45:13 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209862#M61318</guid>
      <dc:creator>Brandon_Wertz</dc:creator>
      <dc:date>2018-04-12T18:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209945#M61345</link>
      <description>&lt;P&gt;this may be useful : &lt;A title="Tips &amp;amp; Tricks: Filtering the security policy" href="https://live.paloaltonetworks.com/t5/Community-Blog/Tips-amp-Tricks-Filtering-the-security-policy/ba-p/163250" target="_blank"&gt;Tips &amp;amp; Tricks: Filtering the security policy&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;log filters look for a positive match in the config file (or a negate of a positive match). values that have not been set can't be searched (in essence, any policy that does not have log forwarding set will not have the attribute in the XML of the config file)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;one exception is when a policy used to have it set, and later was removed, the attribute will remain&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;unfortunately this makes it a little more difficult if you need to look for 'something thats NOT there'&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 09:28:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209945#M61345</guid>
      <dc:creator>reaper</dc:creator>
      <dc:date>2018-04-13T09:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209964#M61349</link>
      <description>&lt;P&gt;Hello, thanks for all your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately (log-setting eq '')&amp;nbsp; does not work for me either. It finds nothing, but there are definitely rules&amp;nbsp;with Log Forwarding = None. Probably due to the behavior reaper mentioned.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 11:11:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/209964#M61349</guid>
      <dc:creator>Anon1</dc:creator>
      <dc:date>2018-04-13T11:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210220#M61411</link>
      <description>&lt;P&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/715"&gt;@Anon1&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Depending on the amount of rules you have it might be worth to spend some time with learning - learning about the XML API and XPATH. If you're alrrady familiar with these topics: Great, then this should be easy for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some basics you can find here:&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/Community-Blog/Export-the-security-rulebase-using-XML-API/ba-p/207981" target="_blank"&gt;https://live.paloaltonetworks.com/t5/Community-Blog/Export-the-security-rulebase-using-XML-API/ba-p/207981&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The most important API request in this case for you is:&lt;/P&gt;&lt;PRE&gt;https://{FIREWALL-IP}/api/?type=config&amp;amp;action=show&amp;amp;key={APIKEY}&amp;amp;xpath={XPATH}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With XPATH you should be able to get only the rules without a log forwarding profile configured.&lt;/P&gt;&lt;P&gt;This XPATH will show you all the existing rules:&lt;/P&gt;&lt;PRE&gt;/config/devices/entry/vsys/entry/rulebase/security&lt;/PRE&gt;&lt;P&gt;If you now add a NOT statement to this XPATH to exclude all the rule with a log forwarding profile:&lt;/P&gt;&lt;PRE&gt;[not(rules/entry/log-setting)]&lt;/PRE&gt;&lt;P&gt;Combined this will give you this API request:&lt;/P&gt;&lt;PRE&gt;https://{FIREWALL-IP}/api/?type=config&amp;amp;action=show&amp;amp;key={APIKEY}&amp;amp;xpath=/config/devices/entry/vsys/entry/rulebase/security[not(rules/entry/log-setting)]&lt;/PRE&gt;&lt;P&gt;With this final request, I am actually not 100% sure if this really works but you can test this easily (copy&amp;amp;paste - done). &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/7608"&gt;@reaper&lt;/a&gt;: Do you know if the XML API has FULL support for XPATH queries?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this does not work, you need to do it in two steps with the help of a scripting language, where you first do the rulebase query and then to the additional XPATH query to reduce the output to the rules without log-forwarding profile. (If it does not work and you're interested in this solution I can post a short example with powershell).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Remo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Apr 2018 19:55:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210220#M61411</guid>
      <dc:creator>Remo</dc:creator>
      <dc:date>2018-04-15T19:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210463#M61484</link>
      <description>&lt;P&gt;Hello Remo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much for the detailed information. It is very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 09:04:14 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210463#M61484</guid>
      <dc:creator>Anon1</dc:creator>
      <dc:date>2018-04-17T09:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210577#M61501</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/16592"&gt;@Remo&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the late reply&lt;/P&gt;
&lt;P&gt;the xpath should fully work, but i dont think you can use 'not' operators (i can't get those to work anyway)&lt;/P&gt;
&lt;P&gt;I'm not the penultimate expert either so I may be wrong &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 21:03:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210577#M61501</guid>
      <dc:creator>reaper</dc:creator>
      <dc:date>2018-04-17T21:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210748#M61523</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/16592"&gt;@Remo&lt;/a&gt; and &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/7608"&gt;@reaper&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested this on&amp;nbsp;panorama (7.1.10)&amp;nbsp;and the 'not' operator worked as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is briliant, I was unaware of the ability to use filters in xpaths like this - I pull the entire config branch, and use a foreach loop and "if" statements to find the applicable entries for this and other instances.&amp;nbsp; Thank you for saving me a lot of future time.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:22:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210748#M61523</guid>
      <dc:creator>JoeAndreini</dc:creator>
      <dc:date>2018-04-18T14:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210779#M61534</link>
      <description>Interesting! Would you mind sharing your full command (minus IP and Key) so I can document this properly?</description>
      <pubDate>Wed, 18 Apr 2018 15:47:46 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210779#M61534</guid>
      <dc:creator>reaper</dc:creator>
      <dc:date>2018-04-18T15:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rules with no log forwarding profile configured</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210793#M61541</link>
      <description>&lt;P&gt;In today's example, I needed to add log-forwarding profiles and threat profile groups to rules that had been imported from the migration tool:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Powershell:&lt;/P&gt;&lt;P&gt;I declare a few variables&lt;/P&gt;&lt;P&gt;$panoramaIP =&lt;/P&gt;&lt;P&gt;$apiKey =&lt;/P&gt;&lt;P&gt;$deviceGroup =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run two "get" calls to obtain the rules that are missing one or both items:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$noLog = invoke-restmethod -URI "https://$panoramaIP/api/?key=$apiKey&amp;amp;type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry/device-group/entry[@name='$deviceGroup']/pre-rulebase/security/rules/entry[not(log-setting)]"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$noProfile = invoke-restmethod -URI "https://$panoramaIP/api/?key=$apiKey&amp;amp;type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry/device-group/entry[@name='$deviceGroup']/pre-rulebase/security/rules/entry[not(profile-setting/group)]"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dig a little deeper in my x-path to make future commands shorter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then for each policy in the lists, i use set calls&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for log forwarding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;invoke-restmethod -URI "https://$panoramaIP/api/?key=$apiKey&amp;amp;type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry/device-group/entry[@name='$deviceGroup']/pre-rulebase/security/rules/entry[@name='$($policy.name)']&amp;amp;element=&amp;lt;log-setting&amp;gt;Log-Forwarding-Profile&amp;lt;/log-setting&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for profile group:&lt;/P&gt;&lt;P&gt;invoke-restmethod -URI "https://$panoramaIP/api/?key=$apiKey&amp;amp;type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry/device-group/entry[@name='$deviceGroup']/pre-rulebase/security/rules/entry[@name='$($policy.name)']&amp;amp;element=&amp;lt;profile-setting&amp;gt;&amp;lt;group&amp;gt;&amp;lt;member&amp;gt;Profile_Group&amp;lt;/member&amp;gt;&amp;lt;/group&amp;gt;&amp;lt;/profile-setting&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;obviously these are only snippits of a longer script.&amp;nbsp; I imagine with the approriate tweaks these xpaths and commands would work for a firewall.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 17:31:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/filter-rules-with-no-log-forwarding-profile-configured/m-p/210793#M61541</guid>
      <dc:creator>JoeAndreini</dc:creator>
      <dc:date>2018-04-18T17:31:26Z</dc:date>
    </item>
  </channel>
</rss>

