{"id":20569545,"url":"https://github.com/magrossi/es-log4j2-appender","last_synced_at":"2025-04-14T16:35:09.605Z","repository":{"id":57721219,"uuid":"102014687","full_name":"magrossi/es-log4j2-appender","owner":"magrossi","description":"An ElasticSearch REST appender for Log4j2","archived":false,"fork":false,"pushed_at":"2019-08-25T08:14:50.000Z","size":161,"stargazers_count":26,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T05:13:39.053Z","etag":null,"topics":["elasticsearch","java-8","log4j2-appender"],"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/magrossi.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":"2017-08-31T15:17:27.000Z","updated_at":"2024-12-29T05:18:08.000Z","dependencies_parsed_at":"2022-09-26T21:41:25.470Z","dependency_job_id":null,"html_url":"https://github.com/magrossi/es-log4j2-appender","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magrossi%2Fes-log4j2-appender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magrossi%2Fes-log4j2-appender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magrossi%2Fes-log4j2-appender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magrossi%2Fes-log4j2-appender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magrossi","download_url":"https://codeload.github.com/magrossi/es-log4j2-appender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248917140,"owners_count":21182935,"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":["elasticsearch","java-8","log4j2-appender"],"created_at":"2024-11-16T05:08:42.604Z","updated_at":"2025-04-14T16:35:09.576Z","avatar_url":"https://github.com/magrossi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ElasticSearch Log4j2 Appender\n\n[![Build Status](https://travis-ci.org/magrossi/es-log4j2-appender.svg?branch=master)](https://travis-ci.org/magrossi/es-log4j2-appender)\n[![Code Coverage](https://codecov.io/gh/magrossi/es-log4j2-appender/branch/master/graph/badge.svg)](https://codecov.io/gh/magrossi/es-log4j2-appender)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.magrossi/log4j2-elasticsearch-appender/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.magrossi/log4j2-elasticsearch-appender)\n\nAn ElasticSearch REST appender for Log4j2\n\nThis is a simple appender that sends your log data JSON formatted directly to ElasticSearch via the REST API. There are options to buffer the logs before sending in bulk. Two options are provided for the buffering of logs.\n- **Max Bulk Size:** when set to a value greater than `0` it will buffer messages until `maxBulkSize` is reached, when it will then send the whole lot using ElasticSearch's `_bulk` API (defaults to `200`).\n- **Max Delay Time:** similarly to the previous option, `maxDelayTime` will accumulate log messages for up to `maxDelayTime` in milliseconds (counted from the first message received) and it will send the entirety of the accumulated messages in a single bulk (defaults to `2000`ms).\n\nAny combination of the two options can be used. Setting any to `0` effectively disables it, if both are set to `0` logs are sent one by one as soon as they are received.\n\nThe appender uses the `JSONLayout` by default, but a custom layout can be provided. The only requirement is that the layout produces an `application/json` content type.\n\nTo use it, simply reference this package into your Log4j2 configuration file, and add the appender with as your ElasticSearch nodes as hosts and you're good to go!\n```xml\n\u003cConfiguration status=\"debug\" strict=\"true\" name=\"ElasticSearchAppenderTest\"\n               packages=\"com.github.magrossi.log4j2.elasticsearch\"\u003e\n    \u003cAppenders\u003e\n        \u003c!-- Sends logs immediately --\u003e\n        \u003cAppender type=\"ElasticSearch\"\n                  \u003c!-- Your appender name --\u003e\n                  name=\"ELASTIC\"\n                  \u003c!-- Accumulate up to \"maxBulkSize\" before sending the logs --\u003e\n                  maxBulkSize=\"0\" \n                  \u003c!-- Waits maxDelayTime (in millis) before sending the logs --\u003e\n                  maxDelayTime=\"0\"\n                  \u003c!-- ElasticSearch index/type configuration --\u003e\n                  esIndex=\"my-index-\"\n                  esType=\"logs\"\n                  \u003c!-- The index name is actually {index}{dateFormat}, so if\n                       esIndex=\"my-index-\", and\n                       dateFormat=\"yyyyMMdd\" (and the current date is 01/01/2001\n                       Then the ElasticSearch index will be resolved to \"my-index-20010101\" --\u003e\n                  dateFormat=\"yyyyMMdd\"\n                  \u003c!-- ElasticSearch credentials, if required --\u003e\n                  user=\"${env:myEsUser}\"\n                  password=\"${env:myEsPassword}\"\u003e\n            \u003c!-- List of nodes in your ElasticSearch cluster --\u003e\n            \u003cHost type=\"HttpAddress\" scheme=\"http\" host=\"my-node-1\" port=\"9200\"/\u003e\n            \u003cHost type=\"HttpAddress\" scheme=\"http\" host=\"my-node-2\" port=\"9200\"/\u003e\n        \u003c/Appender\u003e\n    \u003c/Appenders\u003e\n    \u003cLoggers\u003e\n        \u003cLogger name=\"ELASTIC_LOGGER\" level=\"debug\" additivity=\"false\"\u003e\n            \u003cAppenderRef ref=\"ELASTIC\"/\u003e\n        \u003c/Logger\u003e\n    \u003c/Loggers\u003e\n\u003c/Configuration\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagrossi%2Fes-log4j2-appender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagrossi%2Fes-log4j2-appender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagrossi%2Fes-log4j2-appender/lists"}