Skip to content

kennedyj/loggly-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Logging Loggly Handler

Build Status Coverage Status

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

Installation

Download the repository using pip

sudo pip install loggly-handler

Configuration

Create a Configuration file python.conf and add HTTPSHandler to Configuration File.

[handlers]
keys=HTTPSHandler

[handler_HTTPSHandler]
class=loggly.handlers.HTTPSHandler
level=INFO
args=('https://logs-01.loggly.com/inputs/TOKEN/tag/python','POST')

[formatters]
keys=

[loggers]
keys=root

[logger_root]
handlers=HTTPSHandler

Use Configuration in python file

import logging
import logging.config
import loggly.handlers

logging.config.fileConfig('python.conf')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.info('test Loggly log')

Replace

  • TOKEN: your Loggly Customer Token

About

Python logging handler for loggly

Resources

License

Stars

Watchers

Forks

Packages

No packages published