{"id":37026227,"url":"https://github.com/idealo/logback-redis","last_synced_at":"2026-01-14T03:02:45.888Z","repository":{"id":57730556,"uuid":"61199924","full_name":"idealo/logback-redis","owner":"idealo","description":"Logback Redis Appender with Pipeline-Support for maximum throughput","archived":true,"fork":false,"pushed_at":"2022-06-29T22:19:03.000Z","size":96,"stargazers_count":25,"open_issues_count":0,"forks_count":10,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-08-19T13:31:23.174Z","etag":null,"topics":["logback-access","logback-appender","logback-redis"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idealo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-15T10:36:56.000Z","updated_at":"2025-07-02T22:34:35.000Z","dependencies_parsed_at":"2022-09-26T22:01:27.241Z","dependency_job_id":null,"html_url":"https://github.com/idealo/logback-redis","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/idealo/logback-redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealo%2Flogback-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealo%2Flogback-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealo%2Flogback-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealo%2Flogback-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idealo","download_url":"https://codeload.github.com/idealo/logback-redis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealo%2Flogback-redis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["logback-access","logback-appender","logback-redis"],"created_at":"2026-01-14T03:02:45.238Z","updated_at":"2026-01-14T03:02:45.879Z","avatar_url":"https://github.com/idealo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e # **_IMPORTANT:_** PROJECT SUNSET AND ARCHIVED\n\nNo new maintainers found in https://github.com/idealo/logback-redis/issues/38\n\n# Logback Redis Batch Appender \n [![Build Status](https://travis-ci.org/idealo/logback-redis.svg?branch=master)](https://travis-ci.org/idealo/logback-redis)\n [![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.idealo.logback/logback-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.idealo.logback/logback-redis) \n\nEnables Java applications to log directly to [redis](http://redis.io/) via the [jedis](https://github.com/xetorthio/jedis) client as part of centralized logging with the [ELK](https://www.elastic.co/products) stack.\n\nMore specifically, it uses [async appenders](https://github.com/logstash/logstash-logback-encoder#async) and [JSON encoding](https://github.com/logstash/logstash-logback-encoder#composite_encoder) of the [logstash-logback-encoder](https://github.com/logstash/logstash-logback-encoder) project. Messages are sent to redis in [batches](http://redis.io/topics/pipelining) for performance reasons. The [redis sentinel functionality](http://redis.io/topics/sentinel) is supported.\n\n## Maven dependencies\n``` xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ede.idealo.logback\u003c/groupId\u003e\n   \u003cartifactId\u003elogback-redis\u003c/artifactId\u003e\n   \u003cversion\u003e1.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nused best in conjunction with\n\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003enet.logstash.logback\u003c/groupId\u003e\n   \u003cartifactId\u003elogstash-logback-encoder\u003c/artifactId\u003e\n   \u003cversion\u003e6.2\u003c/version\u003e\n\u003c/dependency\u003e      \n```\n\n## Configuration\n### Simple Configuration \n```xml\n\u003cconfiguration\u003e\n    ...\n    \u003cappender name=\"REDIS\" class=\"net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender\"\u003e\n        \u003cappender class=\"de.idealo.logback.appender.RedisBatchAppender\"\u003e\n            \u003cconnectionConfig\u003e\n                \u003cscheme\u003eSENTINEL\u003c/scheme\u003e\n                \u003csentinelMasterName\u003e${sentinel.master.name}\u003c/sentinelMasterName\u003e\n                \u003csentinels\u003e${sentinel.host.list}\u003c/sentinels\u003e\n                \u003ckey\u003e${sentinel.key}\u003c/key\u003e\n                \u003cssl\u003e${redis.ssl}\u003c/ssl\u003e \u003c!-- false (default) or true --\u003e\n            \u003c/connectionConfig\u003e\n            \u003cencoder class=\"net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder\"\u003e\n                \u003cproviders\u003e\n                    \u003carguments/\u003e\n                    \u003cmdc/\u003e\n                    \u003cpattern\u003e\n                        \u003cpattern\u003e\n                            {\n                            \"@stage\":\"${STAGE}\",\n                            \"app\": \"${projectName}\",\n                            \"host\": \"${HOSTNAME}\",\n                            \"key\" : \"userservices\",\n                            \"level\": \"%level\",\n                            \"logger\": \"%logger\",\n                            \"message\": \"%message\",\n                            \"thread\": \"%thread\",\n                            \"timestamp\": \"%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}\"\n                            }\n                        \u003c/pattern\u003e\n                    \u003c/pattern\u003e\n                    \u003cstackTrace/\u003e\n                \u003c/providers\u003e\n            \u003c/encoder\u003e\n        \u003c/appender\u003e\n    \u003c/appender\u003e\n    ...\n\u003c/configuration\u003e\n```\n\n### Parameters\n* connectionConfig:\n    * key: key under which messages are stored in redis\n    * scheme (NODE | SENTINEL): defines whether redis is accessed via a single node or via [sentinel](http://redis.io/topics/sentinel)\n    * for scheme=SENTINEL:\n        * sentinelMasterName: name of the sentinel master\n        * sentinels: comma separated list of sentinels with the following structure: host1:port1,host2:port2\n    * for scheme=NODE:\n        * host: redis host\n        * port: redis port\n    * method (RPUSH | PUBLISH): defines the method to that should be used to send values to redis. with method PUBLISH the value defined as key is used as channel name. if method is omitted, then RPUSH is used. \n    * ssl: Whether to use SSL to communicate with redis (false or true, default is false). Your client and server certificates must be set up correctly.\n* maxBatchMessages: number of messages which are sent as batch size to redis\n* maxBatchSeconds: time interval in seconds after a batch of messages is sent to redis if the batch size is not reached \n* encoder: encoder for JSON formatting of the messages\n* ringBuffer and waitStrategyType determine [how the logstash-logback-encoder asynchronously processes the messages](https://github.com/logstash/logstash-logback-encoder#async). Note that messages may be lost if the ring buffer size is too small ([\"If the RingBuffer is full (e.g. due to slow network, etc), then events will be dropped.\"](https://github.com/logstash/logstash-logback-encoder#async)).  \n\n### Extended Configuration\n``` xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cconfiguration\u003e\n    \u003cshutdownHook class=\"ch.qos.logback.core.hook.DelayingShutdownHook\"/\u003e\n    \u003cappender name=\"REDIS_APPENDER\" class=\"net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender\"\u003e\n        \u003cringBufferSize\u003e131072\u003c/ringBufferSize\u003e\n        \u003cappender class=\"de.idealo.logback.appender.RedisBatchAppender\"\u003e\n            \u003cconnectionConfig\u003e\n                \u003c!-- redis sentinel: --\u003e\n                \u003cscheme\u003eSENTINEL\u003c/scheme\u003e\n                \u003csentinelMasterName\u003emymaster\u003c/sentinelMasterName\u003e\n                \u003csentinels\u003eserver:26379\u003c/sentinels\u003e\n                \u003c!-- redis node: --\u003e\n                \u003c!--\u003cscheme\u003eNODE\u003c/scheme\u003e--\u003e\n                \u003c!--\u003chost\u003eserver\u003c/host\u003e--\u003e\n                \u003c!--\u003cport\u003e6379\u003c/port\u003e--\u003e\n                \u003ckey\u003ekeyForRedis\u003c/key\u003e\n            \u003c/connectionConfig\u003e\n            \u003cmaxBatchMessages\u003e1000\u003c/maxBatchMessages\u003e\n            \u003cmaxBatchSeconds\u003e10\u003c/maxBatchSeconds\u003e\n            \u003cencoder class=\"net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder\"\u003e\n                \u003cproviders\u003e\n                    \u003cmdc/\u003e\n                    \u003cpattern\u003e\n                        \u003cpattern\u003e\n                            {\n                            \"timestamp\": \"%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}\",\n                            \"message\": \"%message\",\n                            \"logger\": \"%logger\",\n                            \"thread\": \"%thread\",\n                            \"level\": \"%level\",\n                            \"host\": \"${HOSTNAME}\",\n                            \"file\": \"%file\",\n                            \"line\": \"%line\",\n                            \"app\": \"${projectName}\"\n                            }\n                        \u003c/pattern\u003e\n                    \u003c/pattern\u003e\n                    \u003cstackTrace\u003e\n                        \u003cthrowableConverter class=\"net.logstash.logback.stacktrace.ShortenedThrowableConverter\"\u003e\n                            \u003cmaxDepthPerThrowable\u003e30\u003c/maxDepthPerThrowable\u003e\n                            \u003cmaxLength\u003e4096\u003c/maxLength\u003e\n                            \u003cshortenedClassNameLength\u003e20\u003c/shortenedClassNameLength\u003e\n                            \u003crootCauseFirst\u003etrue\u003c/rootCauseFirst\u003e\n                        \u003c/throwableConverter\u003e\n                   \u003c/stackTrace\u003e\n                \u003c/providers\u003e\n            \u003c/encoder\u003e\n        \u003c/appender\u003e\n    \u003c/appender\u003e\n    ...\n\u003c/configuration\u003e\n```\n    \nThis appender configuration can either be included in a logback.xml file (via \"included\" tag) or be directly contained in a logback.xml (without \"included\" tag).\n\n### JSON Format Created by the Appender (Example) (= Input for [Logstash](https://www.elastic.co/products/logstash))\n``` js\n{\n    \"_index\": \"myIndex-2015.09.15.12\",\n    \"_type\": \"logs\",\n    \"_id\": \"AU_RAKiIuARjD1TqcEFe\",\n    \"_score\": null,\n    \"_source\": {\n        \"mdcKey1\": \"value1\",\n        \"mdcKey2\": \"value2\",\n        \"seq\": \"198\",\n        \"timestamp\": \"2015-09-15T14:35:19.256+0200\",\n        \"message\": \"logback-1:198\",\n        \"logger\": \"LoggingTest\",\n        \"thread\": \"main\",\n        \"level\": \"INFO\",\n        \"host\": \"myHost\",\n        \"file\": \"?\",\n        \"line\": \"?\",\n        \"@version\": \"1\",\n        \"@timestamp\": \"2015-09-15T12:35:25.251Z\",\n        \"type\": \"logs\"\n},\n    \"fields\": {\n    \"@timestamp\": [\n        1442320525251\n    ]\n},\n    \"sort\": [\n    1442320525251\n]\n}\n```\n\n### Logging Appender Errors to a File \nThe following logger configuration in the logback.xml is recommended in order to write error messages of the appender directly to a file in error situations (especially if redis is not available):\n``` xml\n\u003clogger name=\"de.idealo.logback.appender\" level=\"error\" additivity=\"false\"\u003e\n    \u003cappender-ref ref=\"FILE_FOR_REDISBATCHAPPENDER\"/\u003e\n\u003c/logger\u003e\n```\n\n## Shutdown\n### Shutdown Hook\nThe redis batch appender must be shut down on application shutdown in order to ensure that cleans up background threads and pools and ensures that remaining messages are sent to Redis before shutting down the app. This is performed by the stop method of the redis batch appender that is automatically called when putting a shutdown hook in logback.xml:\n``` xml\n\u003cshutdownHook class=\"ch.qos.logback.core.hook.DelayingShutdownHook\"/\u003e\n```\n### [Spring Boot](http://projects.spring.io/spring-boot/) Apps\nThe shutdown hook above doesn't work in Spring Boot apps when they are shut down via the [actuator](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready) shutdown URL ([POST {baseUrl}/shutdown](http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html)). Instead, this can be done by the following Spring component:\n``` java\n@Component\npublic class LogbackStopListener implements ApplicationListener\u003cContextClosedEvent\u003e {\n    @Override\n    public void onApplicationEvent(final ContextClosedEvent event) {\n        LogbackUtils.stopLogback();\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealo%2Flogback-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidealo%2Flogback-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealo%2Flogback-redis/lists"}