I am trying to tune the log levels of the various loggers in the Cloudwatch Logs Agent, and according to the official AWS reference docs, it states that I should be able to add the following to /var/awslogs/etc/awslogs.conf, in order to achieve that:
[loggers]
keys=root,cwlogs,reader,publisher
[handlers]
keys=consoleHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=INFO
handlers=consoleHandler
[logger_cwlogs]
level=INFO
handlers=consoleHandler
qualname=cwlogs.push
propagate=0
[logger_reader]
level=WARNING
handlers=consoleHandler
qualname=cwlogs.push.reader
propagate=0
[logger_publisher]
level=WARNING
handlers=consoleHandler
qualname=cwlogs.push.publisher
propagate=0
[handler_consoleHandler]
class=logging.StreamHandler
level=INFO
formatter=simpleFormatter
args=(sys.stderr,)
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(process)d - %(threadName)s - %(message)s
When I do add it, logs forwarding stops and I see a relevant entry in /var/log/awslogs.log
:
No option 'file' in section: 'loggers'
Removing the whole section resumes logging, but - obviously - no log levels have been tuned.
Any ideas what I might be doing wrong?
Do not add these options to
awslogs.conf
. Add them to a separate file that you then specify via thelogging_config_file
key inawslogs.conf
:/etc/awslogs/awslogs.conf
/etc/awslogs/logging.conf