0

I'm running a rsyslog service in a docker container.

Its configuration(rsyslog.conf) looks like below,

module(load="imuxsock") # local system logging support (e.g. via logger command)

module(load="imudp") # UDP listener support module(load="imtcp")

module(load="mmutf8fix")

action(type="mmutf8fix")

LOCAL1.* action(type="omfile" file="/var/log/my.log")

The client program is Java program that is using logback to write the log to both local file and remote rsyslog service.

The local log file looks like for non-ascii characters, whose encoding is UTF-8.

However the output file of rsyslog is NOT UTF-8. Of course the non-ascii characters can not be shown properly.

➜ rsyslog git:(master) ✗ file /volume/disk/logs/svt/my.log

/volume/disk/logs/svt/my.log: ASCII text, with very long lines

I'm wondering how to configure rsyslog to write output as UTF-8, there is no obvious solution after searching Google.

0

I solved it.

The problem is that the default locale of the container is not UTF-8. I'm using alpine linux as the OS of rsyslog container. Finally adding below environment declarations in Dockerfile to fix the encoding issue.

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.