How to use the logentries.le.Stats function in Logentries

To help you get started, we’ve selected a few Logentries examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LogentriesCommunity / le_openshift / logentries / le.py View on Github external
config.agent_key_required()

    # Ensure all configured logs are created
    if config.configured_logs and not config.datahub:
        create_configured_logs(config.configured_logs)

    if config.daemon:
        daemonize()

    # Start default transport channel
    default_transport = DefaultTransport(config)

    # Register resource monitoring
    if config.agent_key != NOT_SET and config.v1_metrics != 'False':
        log.debug("Enabling V1 metrics")
        stats = Stats()
        stats.start()
    else:
        log.debug("V1 metrics disabled")
    formatter = formats.FormatSyslog(config.hostname, 'le',
                                     config.metrics.token)
    smetrics = metrics.Metrics(config.metrics, default_transport,
                                formatter, config.debug_metrics)
    smetrics.start()

    followers = []
    transports = []
    try:
        # Load logs to follow and start following them
        if not config.debug_stats_only:
            (followers, transports) = start_followers(default_transport)