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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 16.04上的awslogs服务和CloudWatch Logs Agent问题相关的知识,希望对你有一定的参考价值。

在我的一个运行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.

对此进行故障排除的任何指示都将有很大帮助。

答案

类似的问题发布在以下链接 - 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

结果创建了一个新的代理状态文件,并且在此之后提到的错误消失了。

以上是关于Ubuntu 16.04上的awslogs服务和CloudWatch Logs Agent问题的主要内容,如果未能解决你的问题,请参考以下文章

问题记录 为ubuntu16.04添加windows字体(解决JIRA图表乱码的问题)

Tomcat8无法在Windows Host上的VirtualBox Vagrant中以Ubuntu 16.04启动

Ubuntu 16.04 文件服务器--samba的安装和配置

Docker 1.12.3 在 Ubuntu 16.04 上的安装和配置

Docker 1.12.3 在 Ubuntu 16.04 上的安装和配置

Android Q - ubuntu16.04 上的 VTS 环境设置