Skip to main content

logstashHandler is a basic logging handler for sending to a logstash instance via UDP or TCP encoded as json.

Basic usage

Setup an input on the relevant logstash server:

input {
  udp {
    port => 12345
    codec => json
  }
}

Setup handler and ship logs:

python
from logstashHandler import logstashHandler

lhandler = logstashHandler(host='mylogserver.example.com',port=12345,proto='UDP')
logger.addHandler(lhandler)
logger.warn("Something went wrong")

To send additional fields to logstash, use the keyword extra and send a dict starting with extraFields:

logger.warn('DANGER DANGER',extra={'extraFields':{'name':'W. Robinsson', 'planet':'Unkown'}})

The default level field name and individual level names can be overridden as so:

levels = {'ERROR': 3, 'WARNING': 2, 'INFO': 1, 'DEBUG': 0}
lhandler = logstashHandler(
    host='mylogserver.example.com',
    port=12345,
    proto='UDP',
    levels=levels,
    levelLabel='severity'
)

More info can be found on the github page.

Release files for logstashHandler 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logstashHandler 0.1.4
File Size Uploaded
logstashHandler-0.1.4.tar.gz 2.3 kB Details

Release files / logstashHandler-0.1.4.tar.gz

Download URL logstashHandler-0.1.4.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
23e0cb46a813a07d15041174824d0135bda891d54fdbb783337995e9633cc40d
BLAKE2b-256 checksum
How to use checksums
ea3b285219d3164a097763bd480f7fc8de2b00870ac7cb0eb37c254b0074c1ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page