Have Squid log to /dev/stdout to stream logs to Cloud Logging (#980)
This commit is contained in:
@@ -68,10 +68,10 @@ write_files:
|
||||
[Service]
|
||||
Environment="HOME=/home/squid"
|
||||
ExecStartPre=/usr/bin/docker-credential-gcr configure-docker
|
||||
ExecStart=/usr/bin/docker run --rm --name=squid \
|
||||
ExecStart=/usr/bin/docker run --rm --name=squid \
|
||||
--network host \
|
||||
-v /etc/squid:/etc/squid \
|
||||
gcr.io/pso-cft-fabric/squid:0.10
|
||||
gcr.io/pso-cft-fabric/squid:20221116
|
||||
ExecStop=/usr/bin/docker stop squid
|
||||
ExecStopPost=/usr/bin/docker rm squid
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ FROM debian:buster-slim
|
||||
ENV SQUID_VERSION=4.6 \
|
||||
SQUID_CACHE_DIR=/var/spool/squid \
|
||||
SQUID_LOG_DIR=/var/log/squid \
|
||||
SQUID_PID_DIR=/var/run/squid \
|
||||
SQUID_USER=proxy
|
||||
|
||||
RUN apt-get update \
|
||||
@@ -26,5 +27,12 @@ RUN apt-get update \
|
||||
COPY entrypoint.sh /sbin/entrypoint.sh
|
||||
RUN chmod 755 /sbin/entrypoint.sh
|
||||
|
||||
# Create the PID file directory as root, as the non-privileged user squid is not
|
||||
# allowed to write in /var/run.
|
||||
RUN mkdir -p ${SQUID_PID_DIR} \
|
||||
&& chown ${SQUID_USER}:${SQUID_USER} ${SQUID_PID_DIR}
|
||||
|
||||
USER ${SQUID_USER}
|
||||
|
||||
EXPOSE 3128/tcp
|
||||
ENTRYPOINT ["/sbin/entrypoint.sh"]
|
||||
|
||||
@@ -24,7 +24,7 @@ steps:
|
||||
- .
|
||||
|
||||
substitutions:
|
||||
_IMAGE_VERSION: "20210215"
|
||||
_IMAGE_VERSION: "20221116"
|
||||
images:
|
||||
- "gcr.io/$PROJECT_ID/squid:${_IMAGE_VERSION}"
|
||||
- "gcr.io/$PROJECT_ID/squid:latest"
|
||||
|
||||
@@ -4,6 +4,14 @@ http_port 0.0.0.0:3128
|
||||
# only proxy, don't cache
|
||||
cache deny all
|
||||
|
||||
# redirect all logs to /dev/stdout
|
||||
logfile_rotate 0
|
||||
cache_log stdio:/dev/stdout
|
||||
access_log stdio:/dev/stdout
|
||||
cache_store_log stdio:/dev/stdout
|
||||
|
||||
pid_filename /var/run/squid/squid.pid
|
||||
|
||||
acl ssl_ports port 443
|
||||
acl safe_ports port 80
|
||||
acl safe_ports port 443
|
||||
|
||||
Reference in New Issue
Block a user