Skip to content

Commit

Permalink
Add LOG_TO_STDOUT variable + documentation (#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
kushagharahi committed Sep 28, 2020
1 parent 2287ee9 commit e3d27e8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions DockerEnv
Expand Up @@ -88,3 +88,4 @@
#WEBPROXY_USERNAME=
#WEBPROXY_PASSWORD=
#DOCKER_LOG=false
#LOG_TO_STDOUT=false
3 changes: 2 additions & 1 deletion Dockerfile
Expand Up @@ -136,7 +136,8 @@ ENV OPENVPN_USERNAME=**None** \
WEBPROXY_USERNAME= \
WEBPROXY_PASSWORD= \
HEALTH_CHECK_HOST=google.com \
DOCKER_LOG=false
DOCKER_LOG=false \
LOG_TO_STDOUT=false

HEALTHCHECK --interval=5m CMD /etc/scripts/healthcheck.sh

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.alpine
Expand Up @@ -126,6 +126,7 @@ ENV OPENVPN_USERNAME=**None** \
WEBPROXY_USERNAME= \
WEBPROXY_PASSWORD= \
DOCKER_LOG=false \
LOG_TO_STDOUT=false \
HEALTH_CHECK_HOST=google.com

HEALTHCHECK --interval=5m CMD /etc/scripts/healthcheck.sh
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.armhf
Expand Up @@ -130,6 +130,7 @@ ENV OPENVPN_USERNAME=**None** \
WEBPROXY_USERNAME= \
WEBPROXY_PASSWORD= \
DOCKER_LOG=false \
LOG_TO_STDOUT=false \
HEALTH_CHECK_HOST=google.com

HEALTHCHECK --interval=5m CMD /etc/scripts/healthcheck.sh
Expand Down
8 changes: 8 additions & 0 deletions docs/arguments.md
Expand Up @@ -105,3 +105,11 @@ This might lead to the default route (your untunneled connection) to be used.
To drop the default route set the environment variable `DROP_DEFAULT_ROUTE` to `true`.

*Note*: This is not compatible with all VPNs. You can check your iptables routing with the `ip r` command in a running container.

### Changing logging locations

By default Transmission will log to a file in `TRANSMISSION_HOME/transmission.log`.

To log to stdout instead set the environment variable `LOG_TO_STDOUT` to `true`.

*Note*: By default stdout is what container engines read logs from. Set this to true to have Tranmission logs in commands like `docker logs` and `kubectl logs`. OpenVPN currently only logs to stdout.
5 changes: 3 additions & 2 deletions transmission/environment-variables.tmpl
Expand Up @@ -97,5 +97,6 @@ export DROP_DEFAULT_ROUTE={{ .Env.DROP_DEFAULT_ROUTE }}
# Support using transmission ids for transmission paths
export GLOBAL_APPLY_PERMISSIONS={{ .Env.GLOBAL_APPLY_PERMISSIONS }}

#Support logging to docker logs
export DOCKER_LOG={{ .Env.DOCKER_LOG }}
# Support logging to stdout which docker logs uses, mark either true
export DOCKER_LOG={{ .Env.DOCKER_LOG }} # DEPRECIATED -- variable name does not reflect usage
export LOG_TO_STDOUT={{ .Env.LOG_TO_STDOUT }} # Updated variable name
2 changes: 1 addition & 1 deletion transmission/start.sh
Expand Up @@ -60,7 +60,7 @@ if [[ "true" = "$DROP_DEFAULT_ROUTE" ]]; then
ip r del default || exit 1
fi

if [[ "true" = "$DOCKER_LOG" ]]; then
if [[ "true" = "$DOCKER_LOG" || "true" = "$LOG_TO_STDOUT" ]]; then
LOGFILE=/dev/stdout
else
LOGFILE=${TRANSMISSION_HOME}/transmission.log
Expand Down
2 changes: 1 addition & 1 deletion transmission/userSetup.sh
Expand Up @@ -13,7 +13,7 @@ if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then
groupmod -o -g "$PGID" ${RUN_AS};
fi

if [[ "true" = "$DOCKER_LOG" ]]; then
if [[ "true" = "$DOCKER_LOG" || "true" = "$LOG_TO_STDOUT" ]]; then
chown ${RUN_AS}:${RUN_AS} /dev/stdout
fi

Expand Down

0 comments on commit e3d27e8

Please sign in to comment.