Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GelfHttpsHandler #45

Merged
merged 8 commits into from
Aug 24, 2020
Merged

Add GelfHttpsHandler #45

merged 8 commits into from
Aug 24, 2020

Conversation

chilledornaments
Copy link
Contributor

Hello!

This PR relates to #20 . It adds a new class, GelfHttpsHandler, to allow sending message to GELF HTTP inputs that are using TLS.

I've tested this against Graylog 3.3.3 using python 3.8 and the latest version of pygelf. I created a keypair using Hashi Vault and used the keypair to create a TLS-enabled GELF HTTP input.

Sample usage without verification

from pygelf import GelfHttpsHandler
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger.addHandler(GelfHttpsHandler(host="gl.company.corp", port=11994, validate=False))
logger.info("TESTING HTTPS")

Sample usage with verification:

from pygelf import GelfHttpsHandler
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger.addHandler(GelfHttpsHandler(host="gl.company.corp", port=11994, validate=True, ca_certs="/home/manderson/tmp/ca/ca_chain.pem"))
logger.info("TESTING HTTPS")

For clarification, the ca_certs file in the above example contains only the root and intermediate CA public keys.

Important note: this does not support client authentication.

@coveralls
Copy link

coveralls commented Aug 17, 2020

Coverage Status

Coverage increased (+0.5%) to 97.931% when pulling 8dc64f2 on mitchya1:feature/add_gelf_https_handler into 59b9b7c on keeprocking:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-14.3%) to 83.217% when pulling 3179933 on mitchya1:feature/add_gelf_https_handler into 59b9b7c on keeprocking:master.

@keeprocking keeprocking merged commit bbb2150 into keeprocking:master Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants