log4j2-elasticsearch overview

Build Status Maven Central codecov contributions welcome

This is a parent project for log4j2 appender plugins capable of pushing logs in batches to Elasticsearch clusters.

Latest released code (1.4.x) is available here.

Project consists of:




  1. Add this snippet to your pom.xml file:

Ensure that Log4j2 and Jackson FasterXML jars are added as well - see Dependencies section below

  1. Use simple log4j2.xml configuration:
    <Elasticsearch name="elasticsearchAsyncBatch">
        <IndexName indexName="log4j2" />
            <IndexTemplate name="log4j2" path="classpath:indexTemplate.json" />
            <JestHttp serverUris="http://localhost:9200" />

or use new, optimized Apache HC based HTTP client

or log4j2.properties

or configure programmatically

  1. Start logging directly to Elasticsearch!
    Logger log = LogManager.getLogger("Logger that references elasticsearchAsyncBatch")
    log.info("Hello, World!");

Logs not arriving? Visit examples and verify your config.


Be aware that Jackson FasterXML jars that has to be provided by user for this library to work in default mode. Please visit mvnrepository for an overview of provided and compile dependencies

Released to Sonatype OSS repos

Visit submodules' documentation or mvnrepository for XML snippets.