Skip to content

Commit

Permalink
#2305 - Nginx - change configuration to output logs to stdout (#2313)
Browse files Browse the repository at this point in the history
- Configured error_log and access_log to be redirected only to stdout.
Kibana should be responsible for capturing the logs output on stdout.

Notice that error_log is now configured to "info" log level which means
that all the higher [log
levels](https://www.keycdn.com/support/nginx-error-log#nginx-error-log-severity-levels)
will be also logged.
  • Loading branch information
andrepestana-aot authored Sep 19, 2023
1 parent 0da64b0 commit b494a3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions sources/packages/web/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# nginx default configuration.

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

server {
# Log to stdout
access_log /dev/stdout main;
listen ${PORT};
location / {
root /opt/app-root/src;
Expand Down
9 changes: 4 additions & 5 deletions sources/packages/web/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;

# Log to stdout
error_log /dev/stdout info;

pid /tmp/nginx.pid;
events {
worker_connections 1024;
Expand All @@ -8,10 +11,6 @@ http {
include /etc/nginx/mime.types;
include /etc/nginx/conf.d/default.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
}

0 comments on commit b494a3a

Please sign in to comment.