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.
Download the repository using pip
sudo pip install loggly-handler
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
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