Exemplo n.º 1
0
def configure_logdna_logging(logdna_key, logdna_app):
    logdna_options = {}
    logdna_options['index_meta'] = True
    logdna_options['app'] = logdna_app
    logdna_handler = LogDNAHandler(logdna_key, logdna_options)
    logdna_handler.setLevel(logging.DEBUG)
    add_handler_to_logger(logdna_handler)
Exemplo n.º 2
0
    aws_secrets = aws.get_secret(app.config['aws_secret_name'])
    for key, value in aws_secrets.items():
        if key in secret_mapping:
            app.config[secret_mapping[key]][key] = value


# if enabled logs will be sent to LogDNA via ingest api.
if 'LOGDNA_INGESTION_KEY' in os.environ:
    import logging
    from logdna import LogDNAHandler

    logdna_handler = LogDNAHandler(
        os.getenv('LOGDNA_INGESTION_KEY'),
        {'app': 'Nebula', 'include_standard_meta': True})
    log_level = logging.DEBUG if 'DEBUG' in os.environ else logging.INFO
    logdna_handler.setLevel(log_level)
    app.logger.addHandler(logdna_handler)
    app.logger.info('added logdna handler..')


if 'general' not in app.config:
    app.config['general'] = {
        'filecache': '/tmp/nebula',
        'secret_key': 'changeme'
    }

if 'site_name' not in app.config['general']:
    app.config['general']['site_name'] = 'nebula'


# Initialize Celery