Created
July 26, 2022 13:39
-
-
Save xtavras/4a01f7d1f94237a4abcdfb02074453c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import socket | |
import logging | |
from rfc5424logging import Rfc5424SysLogHandler | |
logger = logging.getLogger("promtail") | |
rfc5424Handler = Rfc5424SysLogHandler(address=('syslog.example.com', 514), socktype=socket.SOCK_DGRAM) | |
rfc5424Handler.setLevel(logging.DEBUG) | |
logger.addHandler(rfc5424Handler) | |
logger.warning("this is a UDP test", extra={"msgid": 1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment