Simple and easy way to Manage Log's with RabbitMq
- Get Logs via rabbitMq
- Save Logs via : file , database
- publish log via email
- emit logs via rabbitmq
topic
excgange
- RabbitMq
- PostgreSQL
-
Postgres (config/config.exs) also read ecto documentation
-
setup your mail data (config/config.exs):
- logs_reciver : email address that you wants recieve logs
- relay: if you use gmail
smtp.gmail.com
- username: "[email protected]"
- password: "YOUR PASSWORD"
-
Exchange (config/config.exs):
- debug_exchange: "debug_logs_exchange",
- error_exchange: "error_logs_exchange",
- info_exchange: "info_logs_exchange",
- trace_exchange: "trace_logs_exchange",
- warning_exchange: "warning_logs_exchange"
- mix deps.get
- iex -S mix
- mix run test
- email an error log :
# error log : publish via email
{:ok, connection} = AMQP.Connection.open()
{:ok, channel} = AMQP.Channel.open(connection)
topic = "error.mail"
AMQP.Exchange.topic(channel, @exchange, durable: true)
AMQP.Basic.publish(channel, @exchange, topic, @message)
AMQP.Connection.close(connection)
- clone Node.Js with RabbitMQ
- cd topics
- node publish_topic.js "error.mail" "This Error Message will mailed"