1

In ansible.cfg, I use the log_path variable to define where to save Ansible logs. A log file is generated and filled automatically but log rotation seems ineffective. I need information about Ansible logs rotation.

  • When does log rotates - daily, according to file size, … ?
  • Is it a file rotation or a file content rotation?

After defining log_path in ansible.cfg, I ran Ansible several times for several weeks. The logs are saved but there’s no rotation.

## ansible.cfg
log_path = /my/ansible/log.path

I would have two files:

  • /my/ansible/log.path contains latest logs
  • /my/ansible/log.path.0 for example contains oldest logs

but I only have all logs saved in /my/ansible/log.path.

B--rian
  • 5,578
  • 10
  • 38
  • 89
symsymmas
  • 35
  • 9
  • there is no log rotation, not sure why you assumed there is one. – ilias-sp Aug 26 '19 at 11:14
  • Thank you. I read [this ansible.cfg example](https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg) but I misunderstood the comment over log_path. – symsymmas Aug 26 '19 at 11:32
  • i agree, it does sound misleading the way it was worded. in any case, the official documentation is [here](https://docs.ansible.com/ansible/latest/) in case you want to have a deeper look. – ilias-sp Aug 26 '19 at 12:08

1 Answers1

2

As written here, there’s no log rotation with Ansible.

# logging is off by default unless this path is defined
# if so defined, consider logrotate
#log_path = /var/log/ansible.log
Calum Halpin
  • 1,945
  • 1
  • 10
  • 20
symsymmas
  • 35
  • 9