Using Graylog to log from Nginx in a Docker container.

Julian Brown julian at jlbprof.com
Sat Jan 22 21:22:40 UTC 2022


Currently I run Nginx as a reverse proxy in a Docker container.

FROM nginx

ENV DEBIAN_FRONTEND noninteractive

... Details hidden ...

EXPOSE 80
EXPOSE 443

CMD nginx -g 'daemon off;'

We are wanting to use Graylog, and have it for our other containers.  So I
want to now use it for Nginx.  Graylog is like Syslog.

I went to follow this guide:

https://github.com/ronlut/graylog-content-pack-nginx-docker

It recommends we symbolically link the logs to stdout/stderr (which is
already part of the docker container) and it then uses this language (see
the bottom of the the README.md at github):

Run

Now, when your logs are collected by docker from stdout & stderr, you can
run your docker using this command:

docker run --log-driver=gelf --log-opt
gelf-address=udp://<GraylogIP>:12401 <ImageName> <Command>

for example:

docker run --log-driver=gelf --log-opt
gelf-address=udp://<GraylogIP>:12401 busybox echo Hello Graylog

<https://github.com/ronlut/graylog-content-pack-nginx-docker#screenshots>Has
anyone had any experience with this? Or understand this last set of steps?

Thank you

Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220122/051d0ee5/attachment.htm>


More information about the nginx mailing list