Skip to content

h3xagn/streaming-logs-rabbitmq

Repository files navigation

Streaming logs using RabbitMQ

Overview

More data stacks are shifting towards microservices and communication between them are essential as it sometimes need to communicate to more than one service. Message brokers play a critical part in this architecture by allowing services to communicate by routing messages and storing them. In this post we will be creating a real-time log viewer that consolidates errors across several apps and a python app to process error logs. The blog post with more detail is available here:

In a previous post, I covered a more simple log viewer using the log file and FastAPI:

Repo structure and file descriptions

  • producerX.py: Three simulated apps that produce log messages.
  • consumer1.html and js/consumer1.js: Real-time web consumer display logs from the RabbitMQ exchange.
  • consumer2.py: Simulated consumer that processes all messages from the queues.
  • message_example.json: Example of JSON message generated by the logging handler, python-logging-rabbitmq.

The dependencies and virtual environment details are located in the Pipfile which can be used with pipenv.

License

GNU GPL v3

Author

Coenraad Pretorius