-
Notifications
You must be signed in to change notification settings - Fork 12
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
logging needs to be redirected to stdout and stderr #5
Comments
symlinking /var/log/squid/*.log to /dev/(stdout|stderr) will not work because writing to logs happens with the squid user |
Hi! To fix that, you can add the 'sudo' package, and then add the 'squid' user to sudoers whith this:
Then, add 'USER squid' label just before the ENTRYPOINT label and modify the 'ENTRIPOINT command' to be executed with 'sudo'. With this, the '/dev/stdout', '/dev/stderr' and '/dev/stdin' will be created with the 'squid' user. The squid father-process will run as 'root' user, and its child-processes as 'squid' user; being thus, they will be able to write in '/dev/stdout', '/dev/stderr' and '/dev/stdin'. The last thing that you need to do is add the followings lines to the 'squid.conf' to redirect the logs to the '/dev/stdout':
If you need an example, please use this repo https://github.com/mgvazquez/docker-squid-proxy I hope it has been helpfull. |
Hi, This issue is a bit outdated but another trick is to simply use A lot is going on in |
I tried this but was not able to make it work, I think because it looks like squid closes all FDs as root and then forks to the user squid. If I am doing something wrong, would love if someone could point it out because I'm not thrilled with the sudo solution, though that does work in the meantime. |
I don't use squid anymore, but it worked. This was in my conf file :
And add the container launch as squid : USER squid
ENTRYPOINT ["squid", "-N", "-d", "1"] Be sure to have the related conf file to be readable by the squid user. |
Does not seem to work: (also tried fd/1)
But using |
Use tail with the retry option and run it in the background. I put these two lines in a script that
If you are using bash you can simplify tail:
|
For others that have gone down this path I want to explain why squid probably wasn't able to write to When squid is run as the squid user, writing directly to http://www.squid-cache.org/mail-archive/squid-users/200509/0507.html
More information on |
If you are working in Kubernetes, you can also run a parallel container in a pod containing squid container. This container will tail these (/var/log/squid/{cache,access}.log or any other) logs on its stdout.
|
One other point of note is that if you run the container as the "proxy" user (the user squid suid's to) then this works without any sudo needed. |
|
Hi all, I am facing an issue when run the squid container. kindly help me who to fix this error message docker file entrypoint.sh file [root@ip-192-168-4-198 devops]# cat entrypoint.sh #Run confd to render config file(s) echo "Run confd with backend ${CONFD_BACKEND}" create_log_dir() { create_cache_dir() { create_log_dir #allow arguments to be passed to squid #default behaviour is to launch squid |
Pretty old issue, but I've found myself in the same waters, and I came up with a different solution:
|
It looks like if you are using SME mod (workers > 1), the logs cannot be gathered in Docker logs... Tried /dev/stdout or symlink way but no luck. Any idea? |
No description provided.
The text was updated successfully, but these errors were encountered: