Skip to content

mortaliorchard/loggly-handler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyhton Logging Loggly Handler

Build Status Coverage Status

A simple Pyhton logging Loggly handler that can be used to send to a Loggly gen 1 https endpoint. Borrowed the extra fields concept from the graypy logging library.

Configuration

Replace MY-INPUT with your API-token).

Excerpt for the json logging configuration.

{
  "handlers": {
    "loggly": {
      "class": "loggly.handlers.HTTPSHandler",
      "level": "INFO",
      "url": "https://logs-01.loggly.com/inputs/MY-INPUT",
      "facility": "my-app-name"
    }
  }
}

Adding the handler to a logger

logger = logging.getLogger(__name__)
handler = loggly.handlers.HTTPSHandler('https://logs-01.loggly.com/inputs/MY-INPUT')
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)

logger.info('sent to loggly')

About

Python logging handler for loggly

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 92.9%
  • Makefile 7.1%