File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/log_handlers/__pycache__/log4mongo_mod.cpython-310.pyc
Back
o ;j� � @ sz d Z ddlZddlZddlmZ zddlmZmZ dZW n e y' dZY nw dZ dd � ZG d d� dej�Z dd � ZdS )aK Log4Mongo Logging Handler ========================= This module provides a logging handler for sending salt logs to MongoDB Configuration ------------- In the salt configuration file (e.g. /etc/salt/{master,minion}): .. code-block:: yaml log4mongo_handler: host: mongodb_host port: 27017 database_name: logs collection: salt_logs username: logging password: reindeerflotilla write_concern: 0 log_level: warning Log Level ......... If not set, the log_level will be set to the level defined in the global configuration file setting. .. admonition:: Inspiration This work was inspired by the Salt logging handlers for LogStash and Sentry and by the log4mongo Python implementation. � N)� LOG_LEVELS)�MongoFormatter�MongoHandlerTFZmongoc C s t sdS tS )NF)� HAS_MONGO�__virtualname__� r r �S/opt/saltstack/salt/lib/python3.10/site-packages/salt/log_handlers/log4mongo_mod.py�__virtual__4 s r c @ s e Zd Zdd� ZdS )�FormatterWithHostc C s t � }|�|�}t�� |d<