Skip to content

ergencaner/elk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ELK Stack (ElasticSearch, Logstash, Kibana)

Ready to use ELK Stack on Docker with docker-compose. Best used with microservices.

Installation

Deploy on Docker with docker-compose

docker compose up -d

Usage/Examples

  • Logs will be created with below index pattern
logstash-%{springAppName}-%{host}-%{+YYYY.MM.dd}
  • Logstash is configured to listen to inputs on port 5044
  • Kibana is configured to run on port 5601

Sample logback-spring.xml to use with Spring Boot

  • INFO level logs are sent to Logstash.
  • DEBUG level logs are sent to console.
  • springAppName is also included in order to log microservice name.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
    <springProperty scope="context" name="springAppName" source="spring.application.name"/>
    <springProperty scope="context" name="springAppVersion" source="spring.application.version"/>
    <contextName>${springAppName}</contextName>

    <appender name="logstashNetworkAppender" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
        <destination>localhost:5044</destination>
        <encoder class="net.logstash.logback.encoder.LogstashEncoder">
        </encoder>
        <keepAliveDuration>5 minutes</keepAliveDuration>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>INFO</level>
        </filter>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="logstashNetworkAppender"/>
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration>

License

Distributed under the MIT License. See LICENSE.txt for more information. MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published