File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/log_handlers/__pycache__/logstash_mod.cpython-310.pyc
Back
o ;jH7 � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl m Z z ddlZddlZW n e y7 Y nw e�e�ZdZdd� Zdd� ZG d d � d ej�ZG dd� dejj�ZG d d� dej�ZdS )a� Logstash Logging Handler ======================== .. versionadded:: 0.17.0 This module provides some `Logstash`_ logging handlers. UDP Logging Handler ------------------- For versions of `Logstash`_ before 1.2.0: In the salt configuration file: .. code-block:: yaml logstash_udp_handler: host: 127.0.0.1 port: 9999 version: 0 msg_type: logstash In the `Logstash`_ configuration file: .. code-block:: text input { udp { type => "udp-type" format => "json_event" } } For version 1.2.0 of `Logstash`_ and newer: In the salt configuration file: .. code-block:: yaml logstash_udp_handler: host: 127.0.0.1 port: 9999 version: 1 msg_type: logstash In the `Logstash`_ configuration file: .. code-block:: text input { udp { port => 9999 codec => json } } Please read the `UDP input`_ configuration page for additional information. ZeroMQ Logging Handler ---------------------- For versions of `Logstash`_ before 1.2.0: In the salt configuration file: .. code-block:: yaml logstash_zmq_handler: address: tcp://127.0.0.1:2021 version: 0 In the `Logstash`_ configuration file: .. code-block:: text input { zeromq { type => "zeromq-type" mode => "server" topology => "pubsub" address => "tcp://0.0.0.0:2021" charset => "UTF-8" format => "json_event" } } For version 1.2.0 of `Logstash`_ and newer: In the salt configuration file: .. code-block:: yaml logstash_zmq_handler: address: tcp://127.0.0.1:2021 version: 1 In the `Logstash`_ configuration file: .. code-block:: text input { zeromq { topology => "pubsub" address => "tcp://0.0.0.0:2021" codec => json } } Please read the `ZeroMQ input`_ configuration page for additional information. .. admonition:: Important Logstash Setting One of the most important settings that you should not forget on your `Logstash`_ configuration file regarding these logging handlers is ``format``. Both the `UDP` and `ZeroMQ` inputs need to have ``format`` as ``json_event`` which is what we send over the wire. Log Level ......... Both the ``logstash_udp_handler`` and the ``logstash_zmq_handler`` configuration sections accept an additional setting ``log_level``. If not set, the logging level used will be the one defined for ``log_level`` in the global configuration file section. HWM ... The `high water mark`_ for the ZMQ socket setting. Only applicable for the ``logstash_zmq_handler``. .. admonition:: Inspiration This work was inspired in `pylogstash`_, `python-logstash`_, `canary`_ and the `PyZMQ logging handler`_. .. _`Logstash`: http://logstash.net .. _`canary`: https://github.com/ryanpetrello/canary .. _`pylogstash`: https://github.com/turtlebender/pylogstash .. _`python-logstash`: https://github.com/vklochan/python-logstash .. _`PyZMQ logging handler`: https://github.com/zeromq/pyzmq/blob/master/zmq/log/handlers.py .. _`UDP input`: http://logstash.net/docs/latest/inputs/udp .. _`ZeroMQ input`: http://logstash.net/docs/latest/inputs/zeromq .. _`high water mark`: http://api.zeromq.org/3-2:zmq-setsockopt � N)� LOG_LEVELS�logstashc C s&