Skip to content

Commit

Permalink
update nginx log location
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsmejia committed Nov 3, 2023
1 parent d95a8e0 commit 6f928b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ cat <<EOF >awslogs.conf
[general]
state_file = /var/lib/awslogs/agent-state
[/tmp/error.log]
file = /tmp/error.log
[/var/log/nginx/error.log]
file = /var/log/nginx/error.log
log_group_name = ${log_group}
log_stream_name = log-stream-api-nginx-error-${user}-${stage}
[/tmp/access.log]
file = /tmp/access.log
[/var/log/nginx/access.log]
file = /var/log/nginx/access.log
log_group_name = ${log_group}
log_stream_name = log-stream-api-nginx-access-${user}-${stage}
Expand All @@ -100,7 +100,7 @@ wget https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setu
python3.5 ./awslogs-agent-setup.py --region "${region}" --non-interactive --configfile awslogs.conf
# Rotate the logs, delete after 3 days.
echo "
/tmp/error.log {
/var/log/nginx/error.log {
missingok
notifempty
compress
Expand All @@ -109,7 +109,7 @@ echo "
maxage 3
}" >>/etc/logrotate.conf
echo "
/tmp/access.log {
/var/log/nginx/access.log {
missingok
notifempty
compress
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/api-configuration/nginx_config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Optionally, we can have Nginx sort itself out:
worker_processes auto;

error_log /tmp/error.log error;
error_log /var/log/nginx/error.log error;

events {
# Set this to ulimit -n
Expand All @@ -25,7 +25,7 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /tmp/access.log main;
access_log /var/log/nginx/access.log main;

sendfile on;
client_body_timeout 12;
Expand Down

0 comments on commit 6f928b6

Please sign in to comment.