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

    Suricata log browser memory error

    IDS/IPS
    4
    7
    3.9k
    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.
    • I
      idarlund
      last edited by

      When trying to read suricata logs i get this error:

      PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 623090865 bytes) in /usr/local/www/suricata/suricata_logs_browser.php on line 58.
      

      Is there a way to increase the memory php is allowed to use, or is this a bug in mem alloc on suricata_logs_browser.php?

      1 Reply Last reply Reply Quote 0
      • bmeeksB
        bmeeks
        last edited by

        @idarlund:

        When trying to read suricata logs i get this error:

        PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 623090865 bytes) in /usr/local/www/suricata/suricata_logs_browser.php on line 58.
        

        Is there a way to increase the memory php is allowed to use, or is this a bug in mem alloc on suricata_logs_browser.php?

        No.  This is a system-level call within the PHP source code.  You can hand-edit files if you want, but the next update will overwrite them.  Why don't you instead rotate your logs and/or copy them off someplace else to open them with another editor?  They are plaintext, so any editor can open them.  The package GUI tries to keep things simple and opens them in a modal dialog within Bootstrap, but there are some memory limitations using that approach.

        Bill

        1 Reply Last reply Reply Quote 0
        • RonpfSR
          RonpfS
          last edited by

          You can increase the PHP memory by editing /etc/inc/config.inc

          
          // Set memory limit to 512M on amd64.
          if ($ARCH == "amd64") {
          //	ini_set("memory_limit", "512M");
          	ini_set("memory_limit", "640M");
          } else {
          	ini_set("memory_limit", "128M");
          }
          
          

          You have to redo the modification when you update/upgrade pfsense as it is overwritten during the process.

          2.4.5-RELEASE-p1 (amd64)
          Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
          Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

          1 Reply Last reply Reply Quote 0
          • I
            idarlund
            last edited by

            Thanks to both of you. As you might already know; both solutions worked :)
            Maybe the php memory_limit should be a system tunable in system_advanced_sysctl.php ?

            1 Reply Last reply Reply Quote 0
            • S
              SuperTechie
              last edited by

              Using pfSense 2.4.2p1 and Suricata 4.03, I also get this error.  So I edited the /etc/inc/config.inc to allow 1024M for amd64 and rebooted.  But after I still get:

              PHP ERROR: Type: 1, File: /usr/local/www/suricata/suricata_logs_browser.php, Line: 58, Message: Allowed memory size of 536870912 bytes exhausted (tried to allocate 625753393 bytes)

              This is the section from my config.inc:
              // Set memory limit to 512M on amd64.
              if ($ARCH == "amd64") {
              ini_set("memory_limit", "1024M");
              } else {
              ini_set("memory_limit", "128M");
              }

              Server has 48 Gig of memory so should be no problem right?
              Is this memory setting moved somewhere else now for Suricata?

              1 Reply Last reply Reply Quote 0
              • bmeeksB
                bmeeks
                last edited by

                @RichH:

                Using pfSense 2.4.2p1 and Suricata 4.03, I also get this error.  So I edited the /etc/inc/config.inc to allow 1024M for amd64 and rebooted.  But after I still get:

                PHP ERROR: Type: 1, File: /usr/local/www/suricata/suricata_logs_browser.php, Line: 58, Message: Allowed memory size of 536870912 bytes exhausted (tried to allocate 625753393 bytes)

                This is the section from my config.inc:
                // Set memory limit to 512M on amd64.
                if ($ARCH == "amd64") {
                ini_set("memory_limit", "1024M");
                } else {
                ini_set("memory_limit", "128M");
                }

                Server has 48 Gig of memory so should be no problem right?
                Is this memory setting moved somewhere else now for Suricata?

                If you let your logs get very large, the viewing in the GUI is just not going to work.  The PHP process that the GUI runs within has limits on the amount of memory a given PHP session can consume.  This is set during boot-up time by pfSense.

                If you have a busy network and large log files, I strongly recommend copying them off to another host running an application designed to parse IDS/IPS logs.  There have been some suggestions by users here on the forum. I don't currently have a recommendation as my home network does not generate large logs and the normal rotation logic within the package keeps my logs files of manageable size.

                Bill

                1 Reply Last reply Reply Quote 0
                • S
                  SuperTechie
                  last edited by

                  Thanks Bill, that is probably my issue.

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