Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker images are not properly setting locale #1305

Open
ju2wheels opened this issue Oct 22, 2024 · 3 comments
Open

Docker images are not properly setting locale #1305

ju2wheels opened this issue Oct 22, 2024 · 3 comments

Comments

@ju2wheels
Copy link

ju2wheels commented Oct 22, 2024

We get the following warning out scalyr from the 2.2.17-alpine image:

Detected a non UTF-8 locale (unknown) being used. You are strongly encouraged to set the locale / coding for the agent process to UTF-8. Otherwise things won't work when trying to monitor files with non-ascii content or non-ascii characters in the log file names. On Linux you can do that by setting LANG and LC_ALL environment variable: e.g. export LC_ALL=en_US.UTF-8.

IMO this should be baked into the image (especially if there are any compiled components/extensions as they would have to be set before compiling C that may leverage locales).

For example on Debian/Ubuntu base there is the locales and locales-all packages and the following env vars required to make this work:

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

Is the expectation that we should be setting these after the fact?

[edit] It looks like 2.1.40-alpine had this correctly set as ENV LANG=C.UTF-8 and then it was removed in subsequent releases.

@weilliu
Copy link

weilliu commented Oct 23, 2024

@ju2wheels Did you get this warning message from the latest agent 2.2.17? Does it show when you exec into the agent pod?

@ju2wheels
Copy link
Author

ju2wheels commented Oct 23, 2024

@weilliu Yes thats correct, this message is coming from 2.2.17-alpine.

Its being forwarded from the agent log (/var/log/scalyr-agent-2/agent.log).

The full log line is:

2024-10-22 23:36:50.139Z WARNING [core] [scalyr-agent-2:1659] Detected a non UTF-8 locale (unknown) being used. You are strongly encouraged to set the locale / coding for the agent process to UTF-8. Otherwise things won't work when trying to monitor files with non-ascii content or non-ascii characters in the log file names. On Linux you can do that by setting LANG and LC_ALL environment variable: e.g. export LC_ALL=en_US.UTF-8.

I dont need to exec into the container to see it, its part of the logs we are forwarding to scalyr. It seems to be logged on initial start of the Docker container.

@weilliu
Copy link

weilliu commented Oct 23, 2024

Thank you! We will create an internal ticket to track the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants