33 lines
995 B
Plaintext
33 lines
995 B
Plaintext
# Test that the archive-log script correctly archives a log file that was
|
|
# compressed by Zeek.
|
|
#
|
|
# @TEST-EXEC: bash %INPUT
|
|
|
|
. zeekctl-test-setup
|
|
|
|
archivelog=$ZEEKCTL_INSTALL_PREFIX/share/zeekctl/scripts/archive-log
|
|
logdir=$ZEEKCTL_INSTALL_PREFIX/logs/2013-12-30
|
|
archivedtestlog=${logdir}/zeekctltest.22:24:20-22:30:00.log.gz
|
|
origtestlog=zeekctltest.2013-12-30-22-24-20.log.gz
|
|
|
|
zeekctl install
|
|
|
|
# Create Zeek's working directory, chdir to that dir, and create rotated logs
|
|
mkdir $ZEEKCTL_INSTALL_PREFIX/spool/zeek
|
|
cd $ZEEKCTL_INSTALL_PREFIX/spool/zeek
|
|
cat > ${origtestlog} << _EOF_
|
|
# This is a test zeekctltest.log
|
|
_EOF_
|
|
|
|
# Verify that the log is not archived yet
|
|
test ! -e ${archivedtestlog}
|
|
|
|
${archivelog} ${origtestlog} zeekctltest 13-12-30_22.24.20 13-12-30_22.30.00 0 ascii
|
|
|
|
# Verify that the log is now archived (with correct filename)
|
|
test ! -e ${origtestlog}
|
|
test -f ${archivedtestlog}
|
|
|
|
# Verify that the log was not compressed by archive-log
|
|
grep -q "This is a test" ${archivedtestlog}
|