Sending Logs To GrayLog From A Symfony Application Through RabbitMQ

İbrahim Gündüz
Developer Space
Published in
4 min readSep 17, 2017

--

Message queues are an indispensable part of a system which is under high load. They protect the applications from the destructive impact of the load and help to scale up the applications easily also.

If a system consists of many application instances and/or some devices it means that you have many log producers too. So you should scale out the logging system as you scaled the application. Otherwise, the logging mechanism might be effected from the load that comes from outside, be irresponsible and makes down the entire system easily.

You can scale logging systems using message queues too. Today I’m gonna try to explain how to configure RabbitMQ and Graylog for sending logs to Graylog from a Symfony application through RabbitMQ.

Installing Composer Dependencies:
Install the RabbitMQBundle to access the RabbitMQ instance from the application.

$ composer require php-amqplib/rabbitmq-bundle

Define the RabbitMQ connection into the config.yml

# app/config/config.yml
...
old_sound_rabbit_mq:
connections:
logging:
host: '%rabbitmq_host%'
user: '%rabbitmq_user%'
password: '%rabbitmq_password%'
vhost…

--

--