Skip to content

Latest commit

 

History

History
125 lines (81 loc) · 3.6 KB

README.md

File metadata and controls

125 lines (81 loc) · 3.6 KB

rsyslog in a container

Project URL: https://github.com/jumanjihouse/docker-rsyslog
Registry: https://registry.hub.docker.com/u/jumanjiman/rsyslog/

Download size  Version  Source code  Docker Registry  Circle CI

Table of Contents

Overview

This source is used to build an image for rsyslog. The image contains:

  • rsyslog-x86_64
  • default, minimal configuration that you can easily override

The runtime image is quite small (roughly 8 MB) since it is based on the alpine docker image, which is based on Alpine Linux.

I use this image in combination with logspout to forward log messages from containers to a central syslog server. If a particular docker container only logs to syslog, this rsyslog container provides a way to copy the log messages to docker logs, which gets picked up by logspout.

How-to

Fetch an already-built image

The runtime image is published as jumanjiman/rsyslog.

docker pull jumanjiman/rsyslog

Run

Run a container from the CLI:

docker run -d \
  --name rsyslog.service \
  -h $(hostname) \
  jumanjiman/rsyslog

Run a container that only logs to syslog:

docker run -d \
  --name tftp \
  -h tftp.example.com \
  --volumes-from rsyslog.service \
  jumanjiman/tftp-hpa

Now you can tail the logs from the tftp container:

docker logs -f rsyslog.service

Use systemd for automatic startup

Review and potentially modify the sample systemd unit file at systemd/rsyslog.service, then run:

sudo cp systemd/rsyslog.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start rsyslog
sudo systemctl enable rsyslog

Build

On a docker host, run:

ci/build
ci/tag
ci/test

Publish to a private registry

You can push the built image to a private docker registry:

docker tag rsyslog registry_id/your_id/rsyslog
docker push registry_id/your_id/rsyslog

Contribute

See CONTRIBUTING.md in this repo.

Other rsyslog images

License

See LICENSE in this repo.