项目作者: EricLondon

项目描述 :
Docker Elasticsearch Logstash Filebeat Scala Logback
高级语言: Scala
项目地址: git://github.com/EricLondon/docker-elasticsearch-logstash-filebeat-scala-logback.git


Docker Elasticsearch Logstash Filebeat Scala Logback

  1. # build scala logging app
  2. cd app && sbt assembly
  3. # build docker containers
  4. docker-compose build
  5. # start docker containers
  6. docker-compose up
  7. # search ES with log level query and output parsed message
  8. curl -H 'Content-Type: application/json' -XPOST 'http://localhost:9200/filebeat-*/_search?pretty&sort=@timestamp:desc&size=1' -d '{"query":{"term":{"log_level":"error"}}}' > output.json
  9. cat output.json | jq '.hits.hits[0]._source.log_level'
  10. "ERROR"
  11. cat output.json | jq '.hits.hits[0]._source.logger'
  12. "LogOutputter.LogOutputter$"
  13. cat output.json | jq '.hits.hits[0]._source.thread'
  14. "main"
  15. cat output.json | jq '.hits.hits[0]._source.msg'
  16. "java.lang.RuntimeException: error\n\tat LogOutputter.LogOutputter$.outputLogs(LogOutputter.scala:24)\n\tat LogOutputter.LogOutputter$.delayedEndpoint$LogOutputter$LogOutputter$1(LogOutputter.scala:14)\n\tat LogOutputter.LogOutputter$delayedInit$body.apply(LogOutputter.scala:9)\n\tat scala.Function0.apply$mcV$sp(Function0.scala:34)\n\tat scala.Function0.apply$mcV$sp$(Function0.scala:34)\n\tat scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)\n\tat scala.App.$anonfun$main$1$adapted(App.scala:76)\n\tat scala.collection.immutable.List.foreach(List.scala:389)\n\tat scala.App.main(App.scala:76)\n\tat scala.App.main$(App.scala:74)\n\tat LogOutputter.LogOutputter$.main(LogOutputter.scala:9)\n\tat LogOutputter.LogOutputter.main(LogOutputter.scala)\n"