{"library":"pygelf","title":"GELF Logging Handler","description":"pygelf provides logging handlers for the GELF (Graylog Extended Log Format) specification, allowing Python applications to send logs to Graylog servers or other GELF-compatible log management systems. It supports UDP, TCP, and HTTP transport protocols, including features like compression and chunking for large messages. The current version is 0.4.3, and it receives active maintenance with a moderate release cadence.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pygelf"],"cli":null},"imports":["from pygelf import GELFUDPHandler","from pygelf import GELFTCPHandler","from pygelf import GELFHTTPHandler"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import logging\nimport os\nfrom pygelf import GELFUDPHandler\n\n# Replace with your Graylog host and port, or set as environment variables\nGRAYLOG_HOST = os.environ.get('GRAYLOG_HOST', '127.0.0.1')\nGRAYLOG_PORT = int(os.environ.get('GRAYLOG_PORT', '12201')) # Default GELF UDP port\n\nlogger = logging.getLogger('my_app')\nlogger.setLevel(logging.INFO)\n\n# Configure GELF UDP handler\nhandler = GELFUDPHandler(\n    host=GRAYLOG_HOST,\n    port=GRAYLOG_PORT,\n    _source_host='my_python_app', # Custom field example\n    include_extra_fields=True # Include extra dict fields in log record\n)\nlogger.addHandler(handler)\n\n# Example log messages\nlogger.info(\"This is an informational message.\")\nlogger.warning(\"A warning occurred!\", extra={'user_id': 123, 'transaction_id': 'abc-xyz'})\ntry:\n    1 / 0\nexcept ZeroDivisionError:\n    logger.exception(\"An error occurred during division.\")\n\nprint(f\"Logs sent to {GRAYLOG_HOST}:{GRAYLOG_PORT}. Check your Graylog instance.\")\n","lang":"python","description":"This quickstart demonstrates how to configure a Python logger with `GELFUDPHandler` to send log messages to a Graylog instance. It shows basic info, warning, and exception logging, including how to pass extra fields to GELF. Remember to replace placeholder host/port or set them via environment variables to match your Graylog setup.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"0.4.3","pypi_latest":"0.4.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pygelf","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"18M"}]}}