ahmedrathore
ahmedrathore

Reputation: 17

Ansible "log_path=/var/log/ansible.log" Maximum number of Files & size

I am trying to find, what is default maximum file size of log file "ansible.log". Config file only explain its logrotate so what are the maximum number of files are generated and maximum size of these files. Or is it just a one single file and logrotate after some specific size.

Upvotes: 1

Views: 1463

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 68229

Ansible use Python module logging which does not take care of log-rotation. It is possible to rotate logs in Python, but only 2 Ansible modules use the Pyhton module logging.handlers

(grep git repo)

$ grep -ri logging.handlers  /devel/ansible/
/scratch/ansible/lib/ansible/plugins/callback/syslog_json.py:import logging.handlers
/scratch/ansible/lib/ansible/plugins/callback/syslog_json.py:        self.handler = logging.handlers.SysLogHandler(
/scratch/ansible/lib/ansible/module_utils/network/avi/avi_api.py:    from logging.handlers import SysLogHandler

and no module use the RotatingFileHandler

$ grep -ri RotatingFileHandler  /devel/ansible/

But, it's not that difficult to configure the rotation. For example, take a look at logrotate.yml from the role linux_postinstall.

Upvotes: 2

Related Questions