Home > Mobile >  show timestamp in docker logs info
show timestamp in docker logs info

Time:09-23

i want to add the timestamp to container logs. i did in my build stage but im gotting aloways the timestamp UTC and not UTC 2:

- export current_date=$(TZ=":Europe/Paris" date -u  "%m-%d-%Y_%H:%M:%S")
- echo $current_date
- docker push $CI_IMAGE_COMMIT_TAG

Please who can help me??

CodePudding user response:

date -u

Prints the UTC date. Just omit the -u to get the local date.

export current_date=$(TZ=":Europe/Paris" date  "%m-%d-%Y_%H:%M:%S")

CodePudding user response:

maybe setting a correct/desired timezone in the docker container will do a job. In debian-like containers without timedatectl command: ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime And changing to UTC: ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

  • Related