Skip to content

Python 3+ log handler for sending log records to Google Cloud Stackdriver service as custom logs in batches.

License

Notifications You must be signed in to change notification settings

arunbala/logshuttle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logshuttle

Python 3+ log handler for sending log records to Google Cloud Stackdriver service as custom logs in batches.

A batched log handler that sends the log output to Google Cloud Logging service using the Google cloud client library. When creating this handler, authentication for GCloud should be handled using one of the non-explicit credentials sending methods described in http://gcloud-python.readthedocs.io/en/latest/gcloud-auth.html.

The handler stores upto batch_length (200 by default) log records or send_interval_in_ms (15 s by default) worth of log records before sending all those log records in a batch.

Installation

pip install logshuttle

Usage

Sample - In Code

import logging
from logshuttle import GCloudBatchedLogHandler

logger = logging.getLogger()
logger.addHandler(GCloudBatchedLogHandler())
logger.setLevel(logging.INFO)
logger.info("Test log message to google cloud logging service")

Sample - In Config

[loggers]
keys=gunicorn.access

[handlers]
keys=gcloud

[formatters]
keys=generic

[logger_gunicorn.access]
level=INFO
handlers=gcloud
qualname=gunicorn.access

[handler_gcloud]
class=gcloud_batched_logger.GCloudBatchedLogHandler
level=INFO
formatter=generic
args=()

[formatter_generic]

About

Python 3+ log handler for sending log records to Google Cloud Stackdriver service as custom logs in batches.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages