Ansible "log_path=/var/log/ansible.log";最大文件数尺寸 [英] Ansible "log_path=/var/log/ansible.log" Maximum number of Files & size

查看:26
本文介绍了Ansible "log_path=/var/log/ansible.log";最大文件数尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出日志文件ansible.log"的默认最大文件大小是多少.配置文件只解释它的 logrotate,所以生成的最大文件数和这些文件的最大大小是多少.或者它只是一个单独的文件并在某个特定大小后进行 logrotate.

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.

推荐答案

Ansible 使用 Python 模块 logging 不处理日志轮换.可以在 Python 中旋转日志,但只有 2 个 Ansible 模块使用 Pyhton 模块 logging.处理程序

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 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

并且没有模块使用 RotatingFileHandler

$ grep -ri RotatingFileHandler  /devel/ansible/

但是,配置轮换并不难.例如,看看 logrotate.yml 来自角色 linux_postinstall.

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

这篇关于Ansible "log_path=/var/log/ansible.log";最大文件数尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆