File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/__pycache__/http_logstash.cpython-310.pyc
Back
o ;j7 � @ sB d Z ddlZddlZddlZddlZddiZdd� Zd dd�ZdS ) a� HTTP Logstash engine ========================== An engine that reads messages from the salt event bus and pushes them onto a logstash endpoint via HTTP requests. .. versionchanged:: 2018.3.0 .. note:: By default, this engine take everything from the Salt bus and exports into Logstash. For a better selection of the events that you want to publish, you can use the ``tags`` and ``funs`` options. :configuration: Example configuration .. code-block:: yaml engines: - http_logstash: url: http://blabla.com/salt-stuff tags: - salt/job/*/new - salt/job/*/ret/* funs: - probes.results - bgp.config � NzContent-Typezapplication/jsonc C s* t jjj| dtt jj�|�ddtd�}|S )z5 Issues HTTP queries to the logstash server. �POSTT)Zheader_dict�data�decode�status�opts)�salt�utils�http�query�_HEADERS�json�dumps�__opts__)�urlr �result� r �N/opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/http_logstash.py� _logstash( s � r c C s� t �d��d�rd}nd}tjjj|t d t d��B} |jdd�}|rZd}|r?t|t�r?d }|D ]}t � |d |�r<d}q0|}|rQd|d v rQ|d d |vrQd }|rZt | |d � q1 s^w Y d S )a� Listen to salt events and forward them to logstash. url The Logstash endpoint. funs: ``None`` A list of functions to be compared against, looking into the ``fun`` field from the event data. This option helps to select the events generated by one or more functions. If an event does not have the ``fun`` field in the data section, it will be published. For a better selection, consider using the ``tags`` option. By default, this option accepts any event to be submitted to Logstash. tags: ``None`` A list of pattern to compare the event tag against. By default, this option accepts any event to be submitted to Logstash. �idZ_masterZmasterZminion�sock_dir)r r T)�fullF�tagZfunr N)r �get�endswithr r �eventZ get_event� isinstance�list�fnmatchr ) r Zfuns�tags�instanceZ event_busr ZpublishZfound_matchr r r r �start8 s6 ����r )NN) �__doc__r Zsalt.utils.eventr Zsalt.utils.httpZsalt.utils.jsonr r r r r r r �<module> s
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings