forked from 0k/0k-charms
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
46 lines
1.0 KiB
#!/bin/bash
|
|
|
|
## Should be executable N time in a row with same result.
|
|
|
|
. lib/common
|
|
|
|
set -e
|
|
|
|
LOGS=/var/log/cron
|
|
|
|
## XXXvlab: hum it seems apache logging is run as root, so well...
|
|
# logs_creds=$(cached_cmd_on_base_image apache "stat -c '%u %g' '$LOGS'") || {
|
|
# debug "Failed to query for www-data gid in ${DARKYELLOW}apache${NORMAL} base image."
|
|
# return 1
|
|
# }
|
|
|
|
## XXXvlab: a lot of this intelligence should be moved away into ``logrotate`` charm
|
|
DST="$CONFIGSTORE/$TARGET_SERVICE_NAME/etc/logrotate.d/$SERVICE_NAME"
|
|
file_put "$DST" <<EOF
|
|
/var/log/docker/$SERVICE_NAME/*_script.log {
|
|
weekly
|
|
missingok
|
|
dateext
|
|
dateyesterday
|
|
dateformat _%Y-%m-%d
|
|
extension .log
|
|
rotate 52
|
|
compress
|
|
delaycompress
|
|
notifempty
|
|
create 640 root root
|
|
sharedscripts
|
|
}
|
|
EOF
|
|
|
|
config-add "\
|
|
$MASTER_TARGET_CHARM_NAME:
|
|
volumes:
|
|
- $DST:/etc/logrotate.d/docker-${SERVICE_NAME}:ro
|
|
- $SERVICE_DATASTORE$LOGS:/var/log/docker/$SERVICE_NAME:rw
|
|
"
|
|
config-add "\
|
|
$MASTER_BASE_CHARM_NAME:
|
|
volumes:
|
|
- $SERVICE_DATASTORE$LOGS:$LOGS:rw
|
|
"
|