Subscribe to PHP Freaks RSS

Pehapkari.cz: How to connect ELK with Monolog

syndicated from www.phpdeveloper.org on October 23, 2017

On the Pehapkari.cz blog there's a new tutorial posted showing you how to integrate ELK and Monolog for simpler to use and more robust log handling.

ELK is awesome stack for logging. Monolog is awesome PHP logging library. Let's make them work together. [...] In a nutshell, Monolog offers you a logger, where you send your logs. This logger has multiple handlers, which send these logs wherever you need them. Monolog has many handlers, which enable you to to simply send logs to many destinations, e.g. files, e-mails, slack, logstash, and many more. [...] ELK stack (now known as Elastic stack) stands for Elasticsearch, Logstash, Kibana stack.

After briefly introducing both technologies the author then gets into the integration, showing how to use either the ElasticSearchHandler or Gelf to ship the logs over for handling. Monolong includes the handler to make this work and the post includes the code/configuration to use it. With the logs being sent out the next step is to set up where you're sending them to. In this case it's a RabbitMQ setup that will then send them along to Logstash. Configuration for this is included as well.