Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

Update AWS CloudWatch Log Monitor Config #31

Closed
kingkool68 opened this issue Nov 3, 2017 · 0 comments
Closed

Update AWS CloudWatch Log Monitor Config #31

kingkool68 opened this issue Nov 3, 2017 · 0 comments

Comments

@kingkool68
Copy link
Contributor

The debug.log stream wasn't updating. Turns out we need to specify the log format is in UTC time not local time. Always we want to set log_stream_name to the {instance_id}. This lets us stream the logs to AWS CloudWatch where we can look at an individual stream or a combined stream in a log group. Nifty.

Update AWS CloudWatch log monitor config at /var/awslogs/etc/awslogs.conf

[/var/nginx/spiritedmedia.com.error.log]
datetime_format = %Y/%m/%d %H:%M:%S
file = /var/log/nginx/spiritedmedia.com.error.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/log/nginx/spiritedmedia.com.error.log

[/var/log/nginx/error.log]
datetime_format = %Y/%m/%d %H:%M:%S
file = /var/log/nginx/error.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/log/nginx/error.log

[/var/nginx/spiritedmedia.com.access.log]
datetime_format = %d/%b/%Y %H:%M:%S %z
file = /var/log/nginx/spiritedmedia.com.access.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/log/nginx/spiritedmedia.com.access.log

[/var/www/spiritedmedia.com/htdocs/wp-content/debug.log]
datetime_format = %d-%b-%Y %H:%M:%S
time_zone = UTC
file = /var/www/spiritedmedia.com/htdocs/wp-content/debug.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/www/spiritedmedia.com/htdocs/wp-content/debug.log

Be sure to restart the logging daemon:
sudo service awslogs restart

Probably a good idea to delete the debug.log file as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant