Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Advanced Log Filter - Specify EXACT Port number

    Scheduled Pinned Locked Moved General pfSense Questions
    5 Posts 3 Posters 983 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      anengelsen
      last edited by

      I would like to apply a (destination port) filter to the Firewall logs.

      Is it possible to specify an exact port number? Right now I am getting port values that are not an exact match.

      Example:
      Destination Port #: 19
      Results: 1900, 3190, 19, 51419, etc.

      Screen Shot 2020-05-06 at 10.18.01 AM.png

      Thanks!

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        As the help text under the Apply Filter button says, the fields accept regular expressions. So if you only want to match port 19 then you would anchor the regex with the start and end of string like so: ^19$

        Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 2
        • A
          anengelsen
          last edited by anengelsen

          @jimp That works! Thank you very much.

          This is the external resource that I need to bookmark. ;)
          https://www.php.net/manual/en/function.preg-match.php#105924

          K 1 Reply Last reply Reply Quote 0
          • K
            Konstanti @anengelsen
            last edited by Konstanti

            @anengelsen
            Hi
            you can also use a regular expression like this
            (19)

            c0728892-08bf-486a-9b7f-3bdbc6e7457a-image.png

            1 Reply Last reply Reply Quote 0
            • jimpJ
              jimp Rebel Alliance Developer Netgate
              last edited by

              That matches the string anywhere in the port number, same as leaving it as 19 which isn't what OP wanted. They wanted it to only match port 19 and no others, so using ^19$ is the way to do it.

              Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.