Esempio n. 1
0
def configure_graylog(app):
    """Set up Graylog"""

    additional_fields = {
        "app": APP_NAME,
        "facility": PRODUCT_NAME,
        "environment": app.config['ENVIRONMENT']
    }

    app.logger.setLevel(logging.INFO)
    gelf_upd_handler = GelfUdpHandler(host=app.config["GL_SERVER"],
                                      port=app.config["GL_PORT"],
                                      include_extra_fields=True,
                                      compress=False,
                                      chunk_size=1300,
                                      **additional_fields)

    gelf_upd_handler.debug = True
    gelf_upd_handler.setLevel(logging.INFO)
    app.logger.addFilter(GrayLogContextFilter())
    app.logger.addHandler(gelf_upd_handler)
Esempio n. 2
0
def configure_graylog(authenticator):
    """Set up Graylog"""

    additional_fields = {
        "app": "wotnot-data-access",
        "facility": "wotnot",
        "environment": authenticator.config['ENVIRONMENT']}

    authenticator.logger = logging.getLogger('WotNot_logger')
    authenticator.logger.setLevel(logging.INFO)

    gelf_upd_handler = GelfUdpHandler(host=authenticator.config["GL_SERVER"],
                                      port=authenticator.config["GL_PORT"],
                                      include_extra_fields=True,
                                      compress=False,
                                      chunk_size=1300,
                                      **additional_fields)

    gelf_upd_handler.debug = True
    gelf_upd_handler.setLevel(logging.INFO)

    authenticator.logger.addHandler(gelf_upd_handler)