%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/log/handlers/ |
| Current File : //proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyo |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z d d l m
Z
d d l m Z y d d l
m Z m Z e Z Wn e k
r� e Z n Xd Z d � Z d
e j e
f d � � YZ d � Z d S(
uK
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.
i ( t absolute_importt print_functiont unicode_literalsN( t six( t NewStyleClassMixIn( t
LOG_LEVELS( t MongoHandlert MongoFormatteru mongoc C@ s t s
t St S( N( t HAS_MONGOt Falset __virtualname__( ( ( sC /usr/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyt __virtual__9 s t FormatterWithHostc B@ s e Z d � Z RS( c C@ s, t � } | j | � } t j � | d <| S( Nu hostname( R t formatt sockett gethostname( t selft recordt mongoformattert document( ( sC /usr/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyR
@ s ( t __name__t
__module__R
( ( ( sC /usr/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyR ? s c c@ s� d } | t k r� i d d 6d d 6d d 6d d 6d d 6d d 6d d 6} i } x4 t j | � D]# \ } } t | j | � | | <q_ Wt t | j d
t j d
d � � | d <t d
t � | � } | Vn t Vd S( Nu log4mongo_handleru hostu portu
database_nameu
collectionu usernameu passwordu wu
write_concernu log_levelu erroru levelt formatter( t __opts__R t iteritemst getR R R R ( t
handler_idt
config_fieldst config_optst
config_optt arg_namet handler( ( sC /usr/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyt setup_handlersG s,
( t __doc__t
__future__R R R R t loggingt salt.extR t salt.log.mixinsR t salt.log.setupR t log4mongo.handlersR R t TrueR t ImportErrorR R
R t FormatterR R ( ( ( sC /usr/lib/python2.7/site-packages/salt/log/handlers/log4mongo_mod.pyt <module>$ s