Git Product home page Git Product logo

python-logstash-handler's Introduction

logstash_handler: JSON logs for logstash

This library is provided to allow standard python logging to stream JSON logs to logstash.

Installing

Pip:

pip install logstash_handler

Pypi:

https://pypi.python.org/pypi/logstash_handler

Manual:

python setup.py install

Usage

Json outputs are provided by the LogstashFormatter logging formatter.

import logging
from logstash_formatter import LogstashFormatter
from logstash_handler import LogstashHandler

logger = logging.getLogger()
handler = LogstashHandler('localhost', 5000, ssl=False)
formatter = LogstashFormatter()

handler.setFormatter(formatter)
logger.addHandler(handler)

The LogstashHandler takes the following named parameters:

  • host: host to connect to
  • port: host to connect to
  • ssl: boolean indicating if the stream should be encrypted. Default is True
  • keyfile: The path to the encrypting key
  • certfile: The path to the encrypting certificate

python-logstash-handler's People

Contributors

andreydroid avatar klynch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-logstash-handler's Issues

blocking

Nice simple logging handler, love it. But the question is does it block on socket communication?

It extends SocketHandler and there is no background socket handler, seems to be done in the main thread. If (or more likely when) a socket a is slow, will this not slow down the application?

Example of how to send data

Hello!

First of all, thanks for creating this lib, i cannot find any lib for sending data to logstash which uses ssl.
Second, i dont know if i'm doing something wrong, i just sending some string to logger object do not work at all
Do i need to send information in any special format? Or just sengind a string should work?

logger.info('hello world')

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.