Skip to content

Commit

Permalink
Disable FPM Access Log by default (#374)
Browse files Browse the repository at this point in the history
* Add an option to disable/redirect fpm access logs

* forgot to add removing line in commit

* Disabled access log and moved access log to Debug Mode only

* Removed healthcheck from Apache access logs

---------

Co-authored-by: Ilija Radojkovic <ilija.radojkovic@itcentar.rs>
Co-authored-by: Jay Rogers <jay@521dimensions.com>
  • Loading branch information
3 people authored Jun 19, 2024
1 parent 7d442eb commit 11e8235
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/common/etc/entrypoint.d/1-debug-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ set_fpm_log_level (){
fpm_log_level=$1
sed -i "/\[global\]/a log_level = $fpm_log_level" /usr/local/etc/php-fpm.conf
echo "ℹ️ NOTICE ($script_name): FPM - log_level has been set to \"$fpm_log_level\""

echo "access.log = /proc/self/fd/2" >> /usr/local/etc/php-fpm.d/zzz-docker-php-serversideup-fpm-debug.conf
echo "ℹ️ NOTICE ($script_name): FPM - access.log has been set to \"STDERR\""
}

#######################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ listen = 9000

; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.
; https://bugs.php.net/bug.php?id=73886
access.log = /proc/self/fd/2
; access.log = /proc/self/fd/2

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ ProxyPassReverse "/healthcheck" "fcgi://localhost:9000"
# Set the Proxy Timeout to be 30 minutes
ProxyTimeout 1800

# Configure Log Settings
# Set environment variable for healthcheck requests
SetEnvIf Request_URI "^/healthcheck$" dontlog

# CustomLog directive to conditionally log requests
LogFormat "%l %u %t %v %a \"%r\" %>s %b" comonvhost
CustomLog /dev/stdout comonvhost env=!dontlog

# Configure Log Settings
ErrorLog /dev/stderr
TransferLog /dev/stdout
LogLevel ${LOG_OUTPUT_LEVEL}

# Disable Server Signature for increased security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ ProxyPassReverse "/healthcheck" "fcgi://localhost:9000"
# Set the Proxy Timeout to be 30 minutes
ProxyTimeout 1800

# Configure Log Settings
# Set environment variable for healthcheck requests
SetEnvIf Request_URI "^/healthcheck$" dontlog

# CustomLog directive to conditionally log requests
LogFormat "%l %u %t %v %a \"%r\" %>s %b" comonvhost
CustomLog /dev/stdout comonvhost env=!dontlog

# Configure Log Settings
ErrorLog /dev/stderr
TransferLog /dev/stdout
LogLevel ${LOG_OUTPUT_LEVEL}

# Disable Server Signature for increased security
Expand Down

0 comments on commit 11e8235

Please sign in to comment.