nginxのエラーログをcloudwatch logsに送信する

awslogs install

 sudo yum install -y awslogs

awslogs.conf修正

/etc/awslogs/awslogs.conf
[/var/log/nginx/access.log]
log_group_name = nginx-error_log
log_stream_name = {instance_id}
file = /var/log/nginx/error.log
datetime_format = %Y-%m-%d %H:%M:%S,%3N
initial_position = start_of_file
buffer_duration = 5000

awscli.conf修正

/etc/awslogs/awscli.conf
[plugins]
cwlogs = cwlogs
[default]
region = ap-northeast-1

awslogs起動

  sudo service awslogs start