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/08 10:50]
alfred [Python]
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 53: Línea 56:
 sender.setup('​debug.test',​ host='​127.0.0.1',​ port=24224) sender.setup('​debug.test',​ host='​127.0.0.1',​ port=24224)
 event.Event('​json',​ {"​json":"​message from python"​}) 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>​ </​code>​
wiki2/fluentd.1431082252.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)