devops:logging:elk
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
devops:logging:elk [2023/11/01 07:15] – removed - external edit (Unknown date) 127.0.0.1 | devops:logging:elk [2023/11/01 07:15] (current) – ↷ Page moved from camunda:devops:logging:elk to devops:logging:elk skipidar | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== ELK Stack====== | ||
+ | Elasticsearch | ||
+ | LogStash | ||
+ | Kibana | ||
+ | |||
+ | A nice article | ||
+ | https:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== Java app logs to ELK==== | ||
+ | Here a good tutorial: https:// | ||
+ | |||
+ | |||
+ | === Java Side === | ||
+ | SLF4j as a logging fascade. | ||
+ | Logback is used as logging engine. | ||
+ | |||
+ | == build.gradle == | ||
+ | Gradle config, for the logback | ||
+ | < | ||
+ | dependencies { | ||
+ | |||
+ | |||
+ | // Logging Fascade. From now on - the log interface may be used in code | ||
+ | // https:// | ||
+ | compile group: ' | ||
+ | |||
+ | // Logging engine. From now on the logs are really processed | ||
+ | // and stored in the default location. | ||
+ | //required for logging LoggingEvents | ||
+ | compile ' | ||
+ | |||
+ | //required for logging LoggingEvents | ||
+ | compile ' | ||
+ | |||
+ | // the LogStash encoder, used in STASH-appender, | ||
+ | compile ' | ||
+ | | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | == logback.xml== | ||
+ | Configure the appender to log to logstash. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | <encoder class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <root level=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | === ELK side === | ||
+ | |||
+ | Configure Logstash to receive the data from the tcp appender, via TCP. | ||
+ | |||
+ | Modify the input file: | ||
+ | / | ||
+ | |||
+ | https:// | ||
+ | < | ||
+ | |||
+ | input { | ||
+ | | ||
+ | port => 5044 | ||
+ | codec => json_lines | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | **Achtung: LogStash creates its own index!!! No need to mess around with the manual creation.** | ||
+ | |||
+ | |||
+ | === Docker === | ||
+ | Running ELK in docker for the demo. | ||
+ | |||
+ | < | ||
+ | sudo docker run -v / | ||
+ | |||
+ | </ | ||