This Docker plugin extends and expands Docker's logging capabilities so that customers can push their Docker and container logs to HyperOne Journal service.
- HyperOne Journal created in accordance with the documentation,
- password for the HyperOne resource indicated in the previous item
- Download plugin
docker plugin install h1cr.io/h1-docker-logging-plugin
- Enable plugin
docker plugin enable h1cr.io/h1-docker-logging-plugin
- Clone the repository and check out release branch:
cd h1-docker-journal-plugin
git checkout release
- Build the plugin:
$ make build
- Enable the plugin:
$ make install enable
Configure the plugin separately for each container when using the docker run command. For example:
docker run --rm --label x \
--log-driver 'h1cr.io/h1-docker-logging-plugin:latest' \
--log-opt journal-fqdn=5d78e1427fd7e0228fe18f46.journal.pl-waw-1.hyperone.cloud \
--log-opt journal-token=test \
-it alpine id
Now that the plugin is installed and configured, it will send logs while the container is running.
Each message has the following tags assigned by default. The user has the ability to define your own tags through optional variables and they take precedence.
journal-fqdn
– Journal FQDN that will receive logsjournal-token
– Credential (password) to journal indicated in the parameterjournal-fqdn
labels
– comma-separated list of keys of labels used for tagging of logs. Disabled by default.env
– comma-separated list of keys of labels used for tagging of logs. Disabled by default.env-regex
– A regular expression to match logging-related environment variables. Used for advanced log tag options. If there is collision between the label and env keys, env wins. Disabled by default.flush-buffer-size
– How many pending messages can be collected before sending to journal immediately. Default: 500flush-interval
– How long (in miliseconds) the buffer keeps messages before flushing them. Default: 15000
- Customize config.json for logging plugin stdout
"entrypoint": ["sh","-c","node /src/index.js &> logs.txt"],
- Run following command to access logs:
sudo bash -c 'tail -f -n 1000 /var/lib/docker/plugins/*/rootfs/src/logs.txt'
- 1.0.0 - First version.