devops:logging:elk
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
devops:logging:elk [2018/04/09 08:50] – created skipidar | devops:logging:elk [2023/11/01 07:15] (current) – ↷ Page moved from camunda:devops:logging:elk to devops:logging:elk skipidar | ||
---|---|---|---|
Line 6: | Line 6: | ||
A nice article | A nice article | ||
https:// | 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 / | ||
+ | |||
+ | </ | ||
+ |
devops/logging/elk.1523263810.txt.gz · Last modified: (external edit)