Skip to content

Instantly share code, notes, and snippets.

@faxm0dem
Last active October 18, 2015 15:22
Show Gist options
  • Save faxm0dem/25566d48560d04e38d83 to your computer and use it in GitHub Desktop.
Save faxm0dem/25566d48560d04e38d83 to your computer and use it in GitHub Desktop.
Elasticsearch logs in JSON

Elasticsearch logs in JSON format

Build

cd /tmp
wget -O- http://wwwftp.ciril.fr/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz | tar xfz -
export PATH=/tmp/apache-maven-3.3.3/bin:$PATH
git clone https://github.com/logstash/log4j-jsonevent-layout
cd log4j-jsonevent-layout
mvn assembly:assembly
echo target/jsonevent-layout-*-SNAPSHOT-jar-with-dependencies.jar

Install

Copy the target jar to /path/to/jar/

Configure ES

vi /etc/sysconfig/elasticsearch
ES_CLASSPATH=/path/to/jar/*

vi /etc/elasticsearch/logging.yml
appender:
  file:
    layout:
      type: net.logstash.log4j.JSONEventLayoutV1

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment