I need a very simple thing (for an integration test of a larger system, orchestrated by
docker-compose): to setup a
Docker image with
rsyslog inside, so that when it is run,
rsyslog will emit some
syslog messages over
TCP to another machine (container). How do I do this?
Dockerfile, the question is about
rsyslog configuration and how do I generate some syslog messages? Ideally if they could be predefined (to match them at the other end of the integration test).
I just tried adding the following line:
at the end of
/etc/rsyslog.conf inside my
Docker image, but then apparently I get no message. Is the configuration wrong? Is the TCP port
514 assumed here? Or is there just no
syslog message available when I run this container using
Dockerfile looks like:
FROM debian:10.4 RUN apt-get update && apt-get -y upgrade RUN apt-get -y install rsyslog # ... modify /etc/rsyslog.conf : # - append the *.* @@remote-machine line (see above) # - disable imklog which is causing errors ENTRYPOINT ["/etc/init.d/rsyslog"] CMD ["start"]
You can use the
logger command to create arbitrary syslog messages. For example:
logger --server 172.17.0.2 --priority local7.info --tag TEST Sample log message
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.