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

Log files max lines

Scheduled Pinned Locked Moved pfBlockerNG
7 Posts 2 Posters 1.2k 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.
  • J
    jrey
    last edited by Apr 19, 2023, 6:52 PM

    on the pfBlockerNG options General settings, the "Log Setting (max lines)" section.

    Do the values set in here actually work?
    Appear to me perhaps they do not, as several of the log files have significantly more lines than the default of 20,000 lines they are all set at. Maybe it is just not clear to me what should happen at these limits.
    so what should the logs be doing at the 20,000 lines setting? rolling over x.log.0 - x.log.1 - x.log.2 etc ?

    I've been watching the log size and when they get over a couple of MB, I download and delete them in the GUI.

    The /var/log/pfblockerng directory has only the logs that are active. (ie never any roll over files)

    I just downloaded dns_reply.log when it topped 2MB, for example and at that point in has 23,988 lines. Without checking regularly one file had grown over 8MB.

    pfSense 23.01, pfBlockerNG is version 3.2.0_4
    system logs (so those in /var/log) are respecting their size limits settings and creating .0 .1 etc) as expected

    Thanks

    G 1 Reply Last reply Apr 20, 2023, 8:55 AM Reply Quote 0
    • G
      Gertjan @jrey
      last edited by Gertjan Apr 20, 2023, 8:56 AM Apr 20, 2023, 8:55 AM

      @jrey said in Log files max lines:

      on the pfBlockerNG options General settings, the "Log Setting (max lines)" section.
      Do the values set in here actually work?
      Appear to me perhaps they do not, as several of the log files have significantly more lines than the default of 20,000 lines they are all set at. Maybe it is just not clear to me what should happen at these limits.

      Not the files sizes.
      The number of lines the GUI will show you.
      The GUI really is in trouble when it has to read, filter, format, assemble many (like more then 200000) lines.

      The files are rotated of course.
      Otherwise your pfSense would run out of disk space in no time.

      My /var/unbound/var/log/pfblockerng/dns_reply.log is 20 Mbytes right now, and was 'flushed' yesterday just before midnight.

      917027d6-69ed-4202-b463-0f4b36f786ce-image.png

      Btw : the file has 212000 lines.
      That not the one I want to view with my browser.
      The web server (PHP actually) would try it, and go face up and error out while trying.

      For these files I use SFTP (FTP over SSH) and then it becomes a one click show and it will be very fast.

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      J 1 Reply Last reply Apr 20, 2023, 11:02 AM Reply Quote 0
      • J
        jrey @Gertjan
        last edited by Apr 20, 2023, 11:02 AM

        @gertjan

        Thanks for the response

        a) Max Lines = Max Display Lines (got it)
        in which case the value could be 1 setting for all instead of 1 setting for each file. Personally am not going to "read" 20,000 lines (the default) in this format anyway.

        b) "the files are rotated" or "was flushed yesterday"
        do we know which rotated or flushed?
        I've never seen a "rotation" as such. So assume you are saying they are just flushed.
        is there a control setting to say when this happens? you indicated 20 Mbytes right now, and was flushed yesterday just before midnight.
        is the "20 right now" after the flush at midnight or before?
        can you tie the "just before midnight" to a source event? (like say a scheduled job) (ie what is the trigger for the flush? file size or time of day).

        Thanks again

        J G 2 Replies Last reply Apr 20, 2023, 12:05 PM Reply Quote 0
        • J
          jrey @jrey
          last edited by Apr 20, 2023, 12:05 PM

          @gertjan

          @jrey said in Log files max lines:

          a) Max Lines = Max Display Lines (got it)

          Actually, you must mean when viewed somewhere else because the built in viewer only displays 10,000 lines regardless of the settings, which is again set at the default of 20,000 max lines.

          Those max lines defaults are these and apply only to pfBlockerNG:

          Screen Shot 2023-04-20 at 7.56.49 AM.png

          which seem to have nothing to do with display lines, at least under the log browser shown here : Where the max is "Displaying last 10000 lines only"

          Screen Shot 2023-04-20 at 7.59.20 AM.png

          1 Reply Last reply Reply Quote 0
          • G
            Gertjan @jrey
            last edited by Apr 20, 2023, 12:28 PM

            @jrey said in Log files max lines:

            b) "the files are rotated" or "was flushed yesterday"

            Well, you're right : it's "flushed" 👍

            I started to doubt ....
            So took the manual of pfBlockerng and looked up what actually happens.
            Here : /usr/local/www/pfblockerng/pfblockerng.php, and on line 1134 we have the pfb_log_mgmt() function.
            It shows what happens with all the 'log' files, as dns_reply.log is one of them.
            The 'limit' number is take, and last 'number' of lines are kept as a history, previous lines are discarded.

            The pfb_log_mgmt() function is, among others, called during a 'cron update'.

            @jrey said in Log files max lines:

            is the "20 right now" after the flush at midnight or before?

            Look at your own file, and you'll know ;)

            The first line - it has a date / time stamp. Moment before, the file was truncated, or flushed.
            The last line will be 'moments away' as it shows the last recorded DNS request or action handled by pfBlockerng.

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            J 1 Reply Last reply Apr 20, 2023, 1:16 PM Reply Quote 0
            • J
              jrey @Gertjan
              last edited by Apr 20, 2023, 1:16 PM

              @gertjan said in Log files max lines:

              Well, you're right : it's "flushed"

              Actually it was you that suggested flush, but you also said rotated. I was just trying to clarify which one you actually observed.

              Thanks for providing the hook showing it processes with the cron job, that will be very helpful.

              Just one more quick question. You indicated that you had a file the was 20MB and cleared at midnight.

              What schedule are your cron updates for pfB set for ?
              someone updating every hour, two hours etc should never see large files as you have at 20MB or mine at 8MB

              G 1 Reply Last reply Apr 21, 2023, 6:27 AM Reply Quote 0
              • G
                Gertjan @jrey
                last edited by Apr 21, 2023, 6:27 AM

                @jrey

                pfBlockerng main page :

                dcb17243-a367-4b36-89de-d58344499187-image.png

                Related cron setting :

                7080e3aa-61cc-4e30-b90b-c4cca04ac992-image.png

                But wait :

                5eca5f3f-81bc-4c86-b48a-ca25651934da-image.png

                So, I guess, I've set to 'every day' at 8h15

                The cron settings are now (after a force reload ! - see bottom of the page) :

                589793b6-c3d3-48b8-8c00-78fd6a386b9c-image.png

                where is the "8" ? for 8 o'clock 'AM' ? (bug ?)

                Anyway.

                Note that

                 	/usr/local/bin/php /usr/local/www/pfblockerng/pfblockerng.php cron
                

                will execute

                			syslog(LOG_NOTICE, '[pfBlockerNG] Starting cron process.');
                			pfblockerng_sync_cron();
                

                and the function pfblockerng_sync_cron(); will do a

                	// Call log mgmt function
                	// If Update GUI 'Manual view' is selected. Last output will be missed. So sleep for 5 secs.
                	sleep(5);
                	pfb_log_mgmt();
                

                at the end.

                My dns_reply.log was reduced, while testing, to a mere 20000 (my setting) and it grows rapidly, because I see hundreds of lines per minute.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                7 out of 7
                • First post
                  7/7
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                  This community forum collects and processes your personal information.
                  consent.not_received