Herramientas de usuario

Herramientas del sitio


wiki2:fluentd

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:fluentd [2015/05/07 12:40]
alfred [Plugins]
wiki2:fluentd [2020/05/09 09:25] (actual)
Línea 1: Línea 1:
 ====== Fluentd ====== ====== Fluentd ======
 +
 +It is a service to manage system logs. It takes logs from software (MySQL, Apache, the system...) and unify their format and send them to the required place.
 +
 Also called td-agent. Also called td-agent.
  
Línea 43: Línea 46:
   * Start: ''/​opt/​td-agent/​embedded/​bin/​fluentd-ui start''​   * Start: ''/​opt/​td-agent/​embedded/​bin/​fluentd-ui start''​
  
-==== Installing with Elasticsearch & Kibana ​====+==== Python ​==== 
 +Libraries:  
 +  * [[https://​pypi.python.org/​pypi/​fluent-logger/​|fluent-logger]] 
 +  * [[https://​pypi.python.org/​pypi/​pyfluent|pyfluent]]
  
 +=== Fluentd-logger ===
 +<code python>
 +from fluent import sender, event
 +sender.setup('​debug.test',​ host='​127.0.0.1',​ port=24224)
 +event.Event('​json',​ {"​json":"​message from python"​})
 +</​code>​
 +
 +=== pyfluent ===
 +<code python>
 +import logging
 +from pyfluent.logging import SafeFluentHandler
 +handler = SafeFluentHandler('​localhost',​ 24224, '​pyfluent'​)
 +handler.setLevel(logging.INFO)
 +logger = logging.getLogger()
 +logger.setLevel(logging.INFO)
 +logger.addHandler(handler)
 +logger.info('​hello pyfluent!'​)
 +</​code>​
 +
 +<code python>
 +import logging
 +import logging.config
 +
 +logger = logging.getLogger(__name__)
 +
 +logging.config.dictConfig({
 +    '​version':​ 1,              ​
 +    '​disable_existing_loggers':​ False, ​ # this fixes the problem
 +
 +    '​handlers':​ {
 +        '​fluentd':​ {
 +            '​level':​ '​DEBUG',​
 +            '​class':​ '​pyfluent.logging.SafeFluentHandler',​
 +            '​tag':​ '​test.prueba',​
 +        },
 +    },
 +    '​loggers':​ {
 +        '':​ {                  ​
 +            '​handlers':​ ['​fluentd'​], ​       ​
 +            '​level':​ '​INFO'​
 +        }
 +    }
 +})
 +
 +logger.info('​It works!'​)
 +</​code>​
wiki2/fluentd.1431002432.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)