HUB
Sign inSign up
rabbit-logger logo

area51/rabbit-logger

By area51

•Updated over 9 years ago

Listen to a rabiitmq routingkey and log every message to disk

Image
0

528

area51/rabbit-logger repository overview

This image contains a simple C application which will connect to a rabbitmq server, listen for messages with a specific routing key and log them to disk. These log files will contain each message on a line and the log files can be rotated every hour, minute or day.

For example, create a local directory and add a json file defining what you want logged:

mkdir /tmp/logs vi /tmp/logs/test.json

{ "host": "rabbit-server", "port": 5672, "user": "user", "pass": "pass", "vhost": "/", "queue": { "exchange": "amq.topic", "key": "routing key", "logging": { "name": "Test data", "period": 60, "log": true }, "recording": { "directory": "/opt/logs/test", "suffix": ".txt", "rotate": "hour" } } }

Now run this image:

docker run -it --rm -v /tmp/logs:/opt/logs area51/rabbit-logger rabbitlog /opt/logs/test.json

It will now log into /tmp/logs/test any messages received.

You can also record message rates to a remote service. For example I add the following to the "logging" config:

"logging": { "name": "Test data", "period": 60, "log": true, "http.get": ["https://iot.onl/update?api_key=key&field1={count⁠}"] },

which then submits to a remote IoT style service, e.g. http://iot.onl/channels/18⁠ You can also use thingspeak in a similar manner

Tag summary
Recent tags
Content type
Image
Digest
Size
5.2 MB
Last updated
over 9 years ago
docker pull area51/rabbit-logger:latest