Ubuntu 16.04上的awslogs服务和CloudWatch Logs Agent问题

时间:2018-07-17 12:49:56

标签: amazon-web-services amazon-ec2

在我的一个运行Ubuntu 16.04的AWS ec2实例中,我的/ var / syslog中填充了以下错误。

Jul 17 18:11:21 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:21 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.

/var/log/awslogs.log包含以下消息:

database is locked
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Using default logging configuration.

database is locked
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Using default logging configuration.

database is locked
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Using default logging configuration.

任何排查故障的指针将对您有很大帮助。

2 个答案:

答案 0 :(得分:3)

在以下链接中发布了类似的问题-https://forums.aws.amazon.com/thread.jspa?threadID=165134

我做了以下事情:

a)停止了awslogs服务

$ service awslogs stop

b)删除了/ var / awslogs / state /中的代理状态文件(在我的情况下,我对其进行了重命名)

$  mv agent-state agent-state.old

c)重新启动awslogs服务

$ service awslogs start

结果是创建了一个新的座席状态文件,此后我的帖子中提到的错误消失了。

答案 1 :(得分:1)

请根据您的 Linux 版本尝试以下命令

sudo 服务 awslogs 启动

如果您运行的是 Amazon Linux 2,请尝试以下命令 须藤 systemctl 启动 awslogsd 我花了 2 个小时才弄明白这一点