Add default log rotation
This commit is contained in:
parent
6eb4bdcf0e
commit
85ecee3525
13
package.sh
13
package.sh
|
@ -35,8 +35,10 @@ AWS_FILE=~/aws.conf
|
||||||
INSTALL_ROOT_DIR=/opt/telegraf
|
INSTALL_ROOT_DIR=/opt/telegraf
|
||||||
TELEGRAF_LOG_DIR=/var/log/telegraf
|
TELEGRAF_LOG_DIR=/var/log/telegraf
|
||||||
CONFIG_ROOT_DIR=/etc/opt/telegraf
|
CONFIG_ROOT_DIR=/etc/opt/telegraf
|
||||||
|
LOGROTATE_DIR=/etc/logrotate.d
|
||||||
|
|
||||||
SAMPLE_CONFIGURATION=etc/config.sample.toml
|
SAMPLE_CONFIGURATION=etc/config.sample.toml
|
||||||
|
LOGROTATE_CONFIGURATION=etc/logrotate.d/telegraf
|
||||||
INITD_SCRIPT=scripts/init.sh
|
INITD_SCRIPT=scripts/init.sh
|
||||||
|
|
||||||
TMP_WORK_DIR=`mktemp -d`
|
TMP_WORK_DIR=`mktemp -d`
|
||||||
|
@ -144,6 +146,11 @@ make_dir_tree() {
|
||||||
echo "Failed to create configuration directory -- aborting."
|
echo "Failed to create configuration directory -- aborting."
|
||||||
cleanup_exit 1
|
cleanup_exit 1
|
||||||
fi
|
fi
|
||||||
|
mkdir -p $work_dir/$LOGROTATE_DIR
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to create configuration directory -- aborting."
|
||||||
|
cleanup_exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,6 +258,12 @@ if [ $? -ne 0 ]; then
|
||||||
cleanup_exit 1
|
cleanup_exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp $LOGROTATE_CONFIGURATION $TMP_WORK_DIR/$LOGROTATE_DIR/telegraf.conf
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to copy $LOGROTATE_CONFIGURATION to packaging directory -- aborting."
|
||||||
|
cleanup_exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
generate_postinstall_script $VERSION
|
generate_postinstall_script $VERSION
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
Loading…
Reference in New Issue