ELK Stack

Apr 19th, 2018



Get Docker ELK Stack

Download Docker ELK Stack

Bringing up the stack

$ docker-compose up

Initial setup

Default Kibana index pattern creation

Create an index pattern via the Kibana API:

curl -XPOST -D- 'http://localhost:5601/api/saved_objects/index-pattern' -H 'Content-Type: application/json' -H 'kbn-version: 6.2.3' -d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'

Logback setup

pom dependencies



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>
<configuration debug="true">
    <appender name="stash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
        <!-- encoder is required -->
        <encoder class="net.logstash.logback.encoder.LogstashEncoder" />
    <root level="DEBUG">
        <appender-ref ref="stash" />

Run the app

package com.aripd.pingerbee;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MainApp {

    static final Logger LOG = LoggerFactory.getLogger(MainApp.class);

    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 10; i++) {

            LOG.info("New customer successfully registered");
            LOG.warn("User password will expire in two days");
            LOG.error("Billing system is not available");