ypereirareis / symfony-monitor

A configuration example to monitor Symfony with ELK and logstash-forwarder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symfony Monitor

A docker solution to monitor Symfony and Apache or Nginx with ELK.

How to start

To start building your monitoring dashboards thanks to Kibana, follow these steps:

elk:
  image: ypereirareis/elk
  ports:
    - 8200:9200
    - 4601:5601

forwarder:
  image: ypereirareis/logstash-forwarder
  links:
    - elk

Change the ports mapping if needed. The links configuration of the forwarder is very important !

  • Add volumes matching your Apache/Nginx and Symfony logs directories to the forwarder container:
forwarder:
  ...
  volumes:
    - APACHE_ACCESS_ERROR_LOG_DIR/:/var/log/forwarder/apache
    - NGING_ACCESS_ERROR_LOG_DIR/:/var/log/forwarder/nginx
    - SYMFONY_PROD_DEV_LOG_DIR/:/var/log/forwarder/symfony
  • Start the containers with make start or docker-compose up -d elk forwarder

    • ELK and logstah-forwarder startup can take a few seconds.
    • You can use make logs to see startup logs.
  • Check elastic(search) status http://127.0.0.1:8200

  • Access the Kibana home page http://127.0.0.1:4601

Data/indexes persistence

If you want to persist all your work and configuration even if your remove your containers, just map a volume to the elk container:

elk:
  image: ypereirareis/elk
  ...
  volumes:
    HOST_PATH_TO_STORE_ELASTICSEARCH_CONF/:/var/lib/elasticsearch

## Docker images

This monitoring project is built thanks to two docker images:

Kibana

To see the Kibana UI go to http://127.0.0.1:4601 once containers are started. If everything is OK, you'll see this interface:

Image of index pattern

Click on the Create button because default configurations should be OK. You will then arrive on this screen:

Image of logstash index

You do NOT need to do anything here unless you are an advanced user. Once again default configurations will be OK to start.

So go create your first visualization by clicking the Visualize section in the header.

Image of kibana header

Visualizations

I am gonna show you how to build your first (or two) dead simple visualizations here. Then will see how to add it (or them) in a dashboard.

First visualization

  • Choose the type of vsualization you want => Choose Metric

Image of visualization types

  • Select a search source => Select From a new search

Image of search source

  • The visualization screen, you can see the total number of log line in your logs files.

Image of visualization total log count

  • Save this visualization clicking on the save button and give it a name.

Image of save

Second visualization

  • Repeat the previous steps and choose a Pie chart visualization type

Image of pie chart

  • Add an aggregation configuration to have a repartition by log types (request, doctrine,...)

Image of pie chart type

  • Save this visualization clicking on the save button and give it a name.

Dashboards

  • Click on the Dashboard section in the header, then on the Add visualization button (+)

Image of dashboard

  • Add the previously saved visualizations

Image of dashboard visu

  • Save your dashboard

Image of dashboard saved

Filters / DSL Query

On visualizations and on dashboard you can use Query string query to build filters and more complex monitoring.

  • The input field for Query String Query

Image of dashboard filters

  • Visualisation filters

Image of visualisation filters

  • Dashboard filters

Image of dashboard filters

About

A configuration example to monitor Symfony with ELK and logstash-forwarder


Languages

Language:Makefile 100.0%