{"id":15583496,"url":"https://github.com/osiegmar/logback-gelf","last_synced_at":"2025-05-15T17:04:46.199Z","repository":{"id":9427322,"uuid":"53267515","full_name":"osiegmar/logback-gelf","owner":"osiegmar","description":"Logback appender for sending GELF messages with zero additional dependencies.","archived":false,"fork":false,"pushed_at":"2025-01-03T17:16:06.000Z","size":792,"stargazers_count":229,"open_issues_count":3,"forks_count":60,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-13T06:57:08.304Z","etag":null,"topics":["gelf","gelf-appender","gelf-messages","graylog","logback","logback-appender","tcp","tls-configuration","udp"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osiegmar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-06T17:37:39.000Z","updated_at":"2025-03-14T05:38:55.000Z","dependencies_parsed_at":"2023-01-13T15:20:58.437Z","dependency_job_id":"5c7f0018-4bd5-4319-b2c8-8c5f3e60ac25","html_url":"https://github.com/osiegmar/logback-gelf","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiegmar%2Flogback-gelf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiegmar%2Flogback-gelf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiegmar%2Flogback-gelf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiegmar%2Flogback-gelf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osiegmar","download_url":"https://codeload.github.com/osiegmar/logback-gelf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384987,"owners_count":22062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gelf","gelf-appender","gelf-messages","graylog","logback","logback-appender","tcp","tls-configuration","udp"],"created_at":"2024-10-02T20:08:44.653Z","updated_at":"2025-05-15T17:04:46.164Z","avatar_url":"https://github.com/osiegmar.png","language":"Java","readme":"# Logback GELF\n\n[![build](https://github.com/osiegmar/logback-gelf/actions/workflows/build.yml/badge.svg)](https://github.com/osiegmar/logback-gelf/actions/workflows/build.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/975049eb1352478a89bb6d2e9d43e2be)](https://app.codacy.com/gh/osiegmar/logback-gelf/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![codecov](https://codecov.io/gh/osiegmar/logback-gelf/graph/badge.svg?token=YfDHBxprtb)](https://codecov.io/gh/osiegmar/logback-gelf)\n[![javadoc](https://javadoc.io/badge2/de.siegmar/logback-gelf/javadoc.svg)](https://javadoc.io/doc/de.siegmar/logback-gelf)\n[![Maven Central](https://img.shields.io/maven-central/v/de.siegmar/logback-gelf.svg)](https://central.sonatype.com/artifact/de.siegmar/logback-gelf)\n\nLogback appender for sending GELF (Graylog Extended Log Format) messages with zero additional\ndependencies.\n\n## Features\n\n- UDP (with chunking)\n- TCP (with or without TLS encryption)\n- HTTP(s)\n- GZIP and ZLIB compression (in UDP and HTTP mode)\n- Client side load balancing (round-robin)\n- Forwarding of MDC (Mapped Diagnostic Context)\n- Forwarding of caller data\n- Forwarding of static fields\n- Forwarding of exception root cause\n- No runtime dependencies beside Logback\n\n## Requirements\n\n- Java 11\n- Logback 1.5.15\n\n## Examples\n\nSimple UDP configuration:\n\n```xml\n\u003cconfiguration\u003e\n\n    \u003cappender name=\"GELF\" class=\"de.siegmar.logbackgelf.GelfUdpAppender\"\u003e\n        \u003cgraylogHost\u003elocalhost\u003c/graylogHost\u003e\n        \u003cgraylogPort\u003e12201\u003c/graylogPort\u003e\n    \u003c/appender\u003e\n\n    \u003croot level=\"debug\"\u003e\n        \u003cappender-ref ref=\"GELF\" /\u003e\n    \u003c/root\u003e\n\n\u003c/configuration\u003e\n```\n\nSimple TCP configuration:\n\n```xml\n\u003cconfiguration\u003e\n\n    \u003cappender name=\"GELF\" class=\"de.siegmar.logbackgelf.GelfTcpAppender\"\u003e\n        \u003cgraylogHost\u003elocalhost\u003c/graylogHost\u003e\n        \u003cgraylogPort\u003e12201\u003c/graylogPort\u003e\n    \u003c/appender\u003e\n\n    \u003c!-- Use AsyncAppender to prevent slowdowns --\u003e\n    \u003cappender name=\"ASYNC GELF\" class=\"ch.qos.logback.classic.AsyncAppender\"\u003e\n        \u003cappender-ref ref=\"GELF\" /\u003e\n        \u003cneverBlock\u003etrue\u003c/neverBlock\u003e\n    \u003c/appender\u003e\n\n    \u003croot level=\"debug\"\u003e\n        \u003cappender-ref ref=\"ASYNC GELF\" /\u003e\n    \u003c/root\u003e\n\n\u003c/configuration\u003e\n```\n\nSimple TCP with TLS configuration:\n\n```xml\n\u003cconfiguration\u003e\n\n    \u003cappender name=\"GELF\" class=\"de.siegmar.logbackgelf.GelfTcpTlsAppender\"\u003e\n        \u003cgraylogHost\u003elocalhost\u003c/graylogHost\u003e\n        \u003cgraylogPort\u003e12201\u003c/graylogPort\u003e\n    \u003c/appender\u003e\n\n    \u003c!-- Use AsyncAppender to prevent slowdowns --\u003e\n    \u003cappender name=\"ASYNC GELF\" class=\"ch.qos.logback.classic.AsyncAppender\"\u003e\n        \u003cappender-ref ref=\"GELF\" /\u003e\n        \u003cneverBlock\u003etrue\u003c/neverBlock\u003e\n    \u003c/appender\u003e\n\n    \u003croot level=\"debug\"\u003e\n        \u003cappender-ref ref=\"ASYNC GELF\" /\u003e\n    \u003c/root\u003e\n\n\u003c/configuration\u003e\n```\n\nSimple HTTP configuration:\n\n```xml\n\u003cconfiguration\u003e\n\n    \u003cappender name=\"GELF\" class=\"de.siegmar.logbackgelf.GelfHttpAppender\"\u003e\n        \u003curi\u003ehttps://my.server:12201/gelf\u003c/uri\u003e\n    \u003c/appender\u003e\n\n    \u003c!-- Use AsyncAppender to prevent slowdowns --\u003e\n    \u003cappender name=\"ASYNC GELF\" class=\"ch.qos.logback.classic.AsyncAppender\"\u003e\n        \u003cappender-ref ref=\"GELF\" /\u003e\n        \u003cneverBlock\u003etrue\u003c/neverBlock\u003e\n    \u003c/appender\u003e\n\n    \u003croot level=\"debug\"\u003e\n        \u003cappender-ref ref=\"ASYNC GELF\" /\u003e\n    \u003c/root\u003e\n\n\u003c/configuration\u003e\n```\n\nFind more advanced examples in the [examples directory](examples).\n\n## Configuration\n\n### Appender\n\n`de.siegmar.logbackgelf.GelfUdpAppender`\n\n* **graylogHost**: IP or hostname of graylog server.\n  If the hostname resolves to multiple ip addresses, round-robin will be used.\n* **graylogPort**: Port of graylog server. Default: 12201.\n* **maxChunkSize**: Maximum size of GELF chunks in bytes. Default chunk size is 508 - this prevents\n  IP packet fragmentation. This is also the recommended minimum.\n  Maximum supported chunk size is 65,467 bytes.\n* **compressionMethod**: Compression method to use (NONE, GZIP or ZLIB). Default: GZIP.\n* **messageIdSupplier**: The mechanism that supplies unique message ids that are required by the\n  GELF UDP protocol. Default: `de.siegmar.logbackgelf.MessageIdSupplier`.\n* **encoder**: See Encoder configuration below.\n\n`de.siegmar.logbackgelf.GelfTcpAppender`\n\n* **graylogHost**: IP or hostname of graylog server.\n  If the hostname resolves to multiple ip addresses, round-robin will be used.\n* **graylogPort**: Port of graylog server. Default: 12201.\n* **connectTimeout**: Maximum time (in milliseconds) to wait for establishing a connection. A value\n  of 0 disables the connect timeout. Default: 15,000 milliseconds.\n* **socketTimeout**: Maximum time (in milliseconds) to block when reading a socket. A value of 0 disables\n  the socket timeout. Default: 5,000 milliseconds.\n* **reconnectInterval**: Time interval (in seconds) after an existing connection is closed and\n  re-opened. A value of -1 disables automatic reconnects. Default: 60 seconds.\n* **maxRetries**: Number of retries. A value of 0 disables retry attempts. Default: 2.\n* **retryDelay**: Time (in milliseconds) between retry attempts. Ignored if maxRetries is 0.\n  Default: 3,000 milliseconds.\n* **poolSize**: Number of concurrent tcp connections (minimum 1). Default: 2.\n* **poolMaxWaitTime**: Maximum amount of time (in milliseconds) to wait for a connection to become\n  available from the pool. A value of -1 disables the timeout. Default: 5,000 milliseconds.\n* **poolMaxIdleTime**: Maximum amount of time (in seconds) that a pooled connection can be idle\n  before it is considered 'stale' and will not be reused. A value of -1 disables the max idle time\n  feature. Default: -1 (disabled).\n* **encoder**: See Encoder configuration below.\n\n`de.siegmar.logbackgelf.GelfTcpTlsAppender`\n\n* Everything from GelfTcpAppender\n* **insecure**: If true, skip the TLS certificate validation.\n  You should not use this in production! Default: false.\n\n`de.siegmar.logbackgelf.GelfHttpAppender`\n\n* **uri**: HTTP(s) URI of graylog server (e.g. https://my.server:12201/gelf).\n* **insecure**: If true, skip the TLS certificate validation.\n  You should not use this in production! Default: false.\n* **connectTimeout**: Maximum time (in milliseconds) to wait for establishing a connection. A value\n  of 0 disables the connect timeout. Default: 15,000 milliseconds.\n* **requestTimeout**: Maximum time (in milliseconds) to wait for a response. A value of 0 disables the timeout.\n  Default: 5,000 milliseconds.\n* **maxRetries**: Number of retries. A value of 0 disables retry attempts. Default: 2.\n* **retryDelay**: Time (in milliseconds) between retry attempts. Ignored if maxRetries is 0.\n  Default: 3,000 milliseconds.\n* **compressionMethod**: Compression method to use (NONE, GZIP or ZLIB). Default: GZIP.\n* **encoder**: See Encoder configuration below.\n\n### Encoder\n\n`de.siegmar.logbackgelf.GelfEncoder`\n\n* **originHost**: Origin hostname - will be auto-detected if not specified.\n* **includeRawMessage**: If true, the raw message (with argument placeholders) will be sent, too.\n  Default: false.\n* **includeKeyValues**: If true, key value pairs will be sent, too. Default: true.\n* **includeMarker**: If true, logback markers will be sent, too. Default: false.\n* **includeMdcData**: If true, MDC keys/values will be sent, too. Default: true.\n* **includeCallerData**: If true, caller data (source file-, method-, class name and line) will be\n  sent, too. Default: false.\n* **includeRootCauseData**: If true, root cause exception of the exception passed with the log\n   message will be exposed in the root_cause_class_name and root_cause_message fields.\n   Default: false.\n* **includeLevelName**: If true, the log level name (e.g. DEBUG) will be sent, too. Default: false.\n* **levelNameKey**: The key (i.e. the field name) that should be used for the log level name. \n  This is only relevant when includeLevelName is true. Default: level_name.\n* **loggerNameKey**: The key (i.e. the field name) that should be used for the logger name. \n  Default: logger_name.\n* **threadNameKey**: The key (i.e. the field name) that should be used for the thread name. \n  Default: thread_name.\n* **appendNewline**: If true, a system-dependent newline separator will be added at the end of each message.\n  Don't use this in conjunction with TCP/UDP/HTTP appender, as this is only reasonable for\n  console logging!\n* **shortMessageLayout**: Short message format. Default: `\"%m%nopex\"`.\n* **fullMessageLayout**: Full message format (Stacktrace). Default: `\"%m%n\"`.\n* **numbersAsString**: Log numbers as String. Default: false.\n* **staticFields**: Additional, static fields to send to graylog. Defaults: none.\n\n## Troubleshooting\n\nIf you have any problems, enable the debug mode and check the logs.\n\n```xml\n\u003cconfiguration debug=\"true\"\u003e\n    ...\n\u003c/configuration\u003e\n```\n","funding_links":[],"categories":["日志库"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiegmar%2Flogback-gelf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosiegmar%2Flogback-gelf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiegmar%2Flogback-gelf/lists"}