qiyutech.core.logger module – 写入日志到 journald 或 文件中

备注

This module is part of the qiyutech.core collection (version 1.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install qiyutech.core.

To use it in a playbook, specify: qiyutech.core.logger.

1.0.0 新版功能: of qiyutech.core

Synopsis

  • 写入日志到 journald 或者 临时文件中

备注

This module has a corresponding action plugin.

Parameters

Parameter

Comments

auto_delete

boolean

自动删除临时文件

自动删除写入 journald 的时候创建的临时文件

Choices:

  • no

  • yes ← (default)

ctx

dictionary

上下文

level

string

日志等级

Choices:

  • debug

  • info ← (default)

  • notice

  • warning

  • err

  • crit

  • alert

  • emerg

message_id

string

消息标识

消息标志, journald 中的 MESSAGE_ID, 用户所有的上下文

通过获取:

  • qiyu_log_message_id 变量* QIYU_LOG_MESSAGE_ID 环境变量

如果都没则会自动创建 一个新的 MESSAGE_ID 并 使用 set_facts 复制给 qiyu_log_message_id

msg

string / required

日志消息

storage

string

日志存储位置

  • remote 数据存储到远程控制的机器

  • local 数据存储到(controller)本地文件

Choices:

  • remote ← (default)

  • local

Notes

备注

  • 这个模块不支持 Windows 系统

Examples

- name: 写入日志
  qiyutech.core.logger:
    msg: hello
    ctx:
      key: value

Authors

  • dev