You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

  1. #!/bin/bash
  2. ## Should be executable N time in a row with same result.
  3. . lib/common
  4. set -e
  5. LOGS=/var/log/cron
  6. ## XXXvlab: hum it seems apache logging is run as root, so well...
  7. # logs_creds=$(cached_cmd_on_base_image apache "stat -c '%u %g' '$LOGS'") || {
  8. # debug "Failed to query for www-data gid in ${DARKYELLOW}apache${NORMAL} base image."
  9. # return 1
  10. # }
  11. ## XXXvlab: a lot of this intelligence should be moved away into ``logrotate`` charm
  12. DST="$CONFIGSTORE/$TARGET_SERVICE_NAME/etc/logrotate.d/$SERVICE_NAME"
  13. file_put "$DST" <<EOF
  14. /var/log/docker/$SERVICE_NAME/*_script.log {
  15. weekly
  16. missingok
  17. dateext
  18. dateyesterday
  19. dateformat _%Y-%m-%d
  20. extension .log
  21. rotate 52
  22. compress
  23. delaycompress
  24. notifempty
  25. create 640 root root
  26. sharedscripts
  27. }
  28. EOF
  29. config-add "\
  30. $MASTER_TARGET_CHARM_NAME:
  31. volumes:
  32. - $DST:/etc/logrotate.d/docker-${SERVICE_NAME}:ro
  33. - $SERVICE_DATASTORE$LOGS:/var/log/docker/$SERVICE_NAME:rw
  34. "
  35. config-add "\
  36. $MASTER_BASE_CHARM_NAME:
  37. volumes:
  38. - $SERVICE_DATASTORE$LOGS:$LOGS:rw
  39. "