2009-12-24 18:36:01 +00:00
|
|
|
#! /bin/bash
|
2009-09-14 01:07:32 +00:00
|
|
|
|
|
|
|
run_test ./drive_logfile -f syslog_log ${srcdir}/logfile_syslog.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't infer syslog log format?"
|
|
|
|
|
|
|
|
run_test ./drive_logfile -f tcsh_history ${srcdir}/logfile_tcsh_history.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't infer tcsh-history log format?"
|
|
|
|
|
|
|
|
run_test ./drive_logfile -f access_log ${srcdir}/logfile_access_log.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't infer access_log log format?"
|
|
|
|
|
2010-01-24 20:25:34 +00:00
|
|
|
run_test ./drive_logfile -f strace_log ${srcdir}/logfile_strace_log.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't infer strace_log log format?"
|
|
|
|
|
2015-04-05 14:12:20 +00:00
|
|
|
run_test ./drive_logfile -f zblued_log ${srcdir}/logfile_blued.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't infer blued_log that collides with syslog?"
|
|
|
|
|
2009-09-14 01:07:32 +00:00
|
|
|
|
|
|
|
run_test ./drive_logfile ${srcdir}/logfile_empty.0
|
|
|
|
|
|
|
|
on_error_fail_with "Didn't handle empty log?"
|
|
|
|
|
2014-03-15 11:40:58 +00:00
|
|
|
touch -t 200711030923 ${srcdir}/logfile_syslog.0
|
2009-09-14 01:07:32 +00:00
|
|
|
run_test ./drive_logfile -t -f syslog_log ${srcdir}/logfile_syslog.0
|
|
|
|
|
|
|
|
check_output "Syslog timestamp interpreted incorrectly?" <<EOF
|
|
|
|
Nov 03 09:23:38 2007 -- 000
|
|
|
|
Nov 03 09:23:38 2007 -- 000
|
|
|
|
Nov 03 09:23:38 2007 -- 000
|
|
|
|
Nov 03 09:47:02 2007 -- 000
|
|
|
|
EOF
|
|
|
|
|
2014-03-15 11:40:58 +00:00
|
|
|
touch -t 200711030923 ${srcdir}/logfile_syslog.1
|
2009-09-14 01:07:32 +00:00
|
|
|
run_test ./drive_logfile -t -f syslog_log ${srcdir}/logfile_syslog.1
|
|
|
|
|
|
|
|
check_output "Syslog timestamp interpreted incorrectly for year end?" <<EOF
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Jan 03 09:47:02 2007 -- 000
|
|
|
|
EOF
|
|
|
|
|
2014-03-15 11:40:58 +00:00
|
|
|
gzip -c ${srcdir}/logfile_syslog.1 > logfile_syslog.1.gz
|
|
|
|
|
|
|
|
run_test ./drive_logfile -t -f syslog_log logfile_syslog.1.gz
|
|
|
|
|
|
|
|
check_output "Syslog timestamp incorrect for gzipped file?" <<EOF
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Jan 03 09:47:02 2007 -- 000
|
|
|
|
EOF
|
|
|
|
|
2015-04-01 23:55:09 +00:00
|
|
|
if [ "$BZIP2_SUPPORT" -eq 1 ] && [ x"$BZIP2_CMD" != x"" ] ; then
|
2014-03-15 11:40:58 +00:00
|
|
|
$BZIP2_CMD -z -c "${srcdir}/logfile_syslog.1" > logfile_syslog.1.bz2
|
|
|
|
|
|
|
|
touch -t 200711030923 logfile_syslog.1.bz2
|
|
|
|
run_test ./drive_logfile -t -f syslog_log logfile_syslog.1.bz2
|
|
|
|
|
|
|
|
check_output "bzip2 file not loaded?" <<EOF
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Dec 03 09:23:38 2006 -- 000
|
|
|
|
Jan 03 09:47:02 2007 -- 000
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2014-04-07 14:18:58 +00:00
|
|
|
touch -t 201404061109 ${srcdir}/logfile_tcf.1
|
2014-04-07 05:11:04 +00:00
|
|
|
run_test ./drive_logfile -t -f tcf_log ${srcdir}/logfile_tcf.1
|
|
|
|
|
|
|
|
check_output "TCF timestamp interpreted incorrectly for hour wrap?" <<EOF
|
2014-04-07 14:30:15 +00:00
|
|
|
Apr 06 09:59:47 2014 -- 191
|
|
|
|
Apr 06 10:30:11 2014 -- 474
|
|
|
|
Apr 06 11:01:11 2014 -- 475
|
2014-04-07 05:11:04 +00:00
|
|
|
EOF
|
|
|
|
|
2014-03-15 11:49:37 +00:00
|
|
|
# The TCSH format converts to local time, so we need to specify a TZ
|
|
|
|
export TZ="UTC"
|
2009-09-14 01:07:32 +00:00
|
|
|
run_test ./drive_logfile -t -f tcsh_history ${srcdir}/logfile_tcsh_history.0
|
|
|
|
|
|
|
|
check_output "TCSH timestamp interpreted incorrectly?" <<EOF
|
2014-03-15 11:49:37 +00:00
|
|
|
Nov 02 17:59:26 2006 -- 000
|
|
|
|
Nov 02 17:59:26 2006 -- 000
|
|
|
|
Nov 02 17:59:45 2006 -- 000
|
|
|
|
Nov 02 17:59:45 2006 -- 000
|
2009-09-14 01:07:32 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ./drive_logfile -t -f access_log ${srcdir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "access_log timestamp interpreted incorrectly?" <<EOF
|
|
|
|
Jul 20 22:59:26 2009 -- 000
|
|
|
|
Jul 20 22:59:29 2009 -- 000
|
|
|
|
Jul 20 22:59:29 2009 -- 000
|
|
|
|
EOF
|
|
|
|
|
2014-03-15 11:40:58 +00:00
|
|
|
touch -t 200711030923 ${srcdir}/logfile_strace_log.0
|
2010-01-24 20:25:34 +00:00
|
|
|
run_test ./drive_logfile -t -f strace_log ${srcdir}/logfile_strace_log.0
|
|
|
|
|
|
|
|
check_output "strace_log timestamp interpreted incorrectly?" <<EOF
|
2014-03-15 11:40:58 +00:00
|
|
|
Nov 03 08:09:33 2007 -- 814
|
|
|
|
Nov 03 08:09:33 2007 -- 815
|
|
|
|
Nov 03 08:09:33 2007 -- 815
|
|
|
|
Nov 03 08:09:33 2007 -- 815
|
|
|
|
Nov 03 08:09:33 2007 -- 816
|
|
|
|
Nov 03 08:09:33 2007 -- 816
|
|
|
|
Nov 03 08:09:33 2007 -- 816
|
|
|
|
Nov 03 08:09:33 2007 -- 816
|
|
|
|
Nov 03 08:09:33 2007 -- 816
|
2010-01-24 20:25:34 +00:00
|
|
|
EOF
|
|
|
|
|
2009-09-14 01:07:32 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f syslog_log ${srcdir}/logfile_syslog.0
|
|
|
|
|
|
|
|
check_output "Syslog level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x0a
|
|
|
|
0x07
|
|
|
|
0x0a
|
|
|
|
0x07
|
2009-09-14 01:07:32 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f tcsh_history ${srcdir}/logfile_tcsh_history.0
|
|
|
|
|
|
|
|
check_output "TCSH level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x07
|
|
|
|
0x87
|
|
|
|
0x07
|
|
|
|
0x87
|
2009-09-14 01:07:32 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f access_log ${srcdir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "access_log level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x07
|
|
|
|
0x0a
|
|
|
|
0x07
|
2009-09-14 01:07:32 +00:00
|
|
|
EOF
|
2010-01-24 20:25:34 +00:00
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f strace_log ${srcdir}/logfile_strace_log.0
|
|
|
|
|
|
|
|
check_output "strace_log level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x07
|
|
|
|
0x07
|
|
|
|
0x07
|
|
|
|
0x0a
|
|
|
|
0x07
|
|
|
|
0x0a
|
|
|
|
0x07
|
|
|
|
0x07
|
|
|
|
0x07
|
2010-01-24 20:25:34 +00:00
|
|
|
EOF
|
2012-07-03 19:01:09 +00:00
|
|
|
|
|
|
|
run_test ./drive_logfile -t -f generic_log ${srcdir}/logfile_generic.0
|
|
|
|
|
|
|
|
check_output "generic_log timestamp interpreted incorrectly?" <<EOF
|
|
|
|
Jul 02 10:22:40 2012 -- 672
|
2014-10-30 03:05:33 +00:00
|
|
|
Oct 08 16:56:38 2014 -- 344
|
2012-07-03 19:01:09 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f generic_log ${srcdir}/logfile_generic.0
|
|
|
|
|
|
|
|
check_output "generic_log level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x06
|
|
|
|
0x09
|
2012-07-03 19:01:09 +00:00
|
|
|
EOF
|
2013-05-18 00:44:55 +00:00
|
|
|
|
2014-03-15 11:40:58 +00:00
|
|
|
touch -t 200711030923 ${srcdir}/logfile_glog.0
|
2013-05-18 00:44:55 +00:00
|
|
|
run_test ./drive_logfile -t -f glog_log ${srcdir}/logfile_glog.0
|
|
|
|
|
|
|
|
check_output "glog_log timestamp interpreted incorrectly?" <<EOF
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
May 17 15:04:22 2007 -- 619
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ./drive_logfile -v -f glog_log ${srcdir}/logfile_glog.0
|
|
|
|
|
|
|
|
check_output "glog_log level interpreted incorrectly?" <<EOF
|
2015-04-11 02:50:05 +00:00
|
|
|
0x0a
|
|
|
|
0x07
|
|
|
|
0x07
|
|
|
|
0x09
|
|
|
|
0x07
|
|
|
|
0x07
|
|
|
|
0x0a
|
2013-05-18 00:44:55 +00:00
|
|
|
EOF
|
2014-04-18 12:17:24 +00:00
|
|
|
|
|
|
|
cp ${srcdir}/logfile_syslog.0 truncfile.0
|
2014-11-04 04:41:38 +00:00
|
|
|
chmod u+w truncfile.0
|
2014-04-18 12:17:24 +00:00
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ";update syslog_log set log_mark = 1 where log_line = 1" \
|
|
|
|
-c ":write-to truncfile.0" \
|
|
|
|
-c ":goto 1" \
|
|
|
|
truncfile.0
|
|
|
|
|
|
|
|
check_output "truncated log file not detected" <<EOF
|
|
|
|
Nov 3 09:23:38 veridian automount[16442]: attempting to mount entry /auto/opt
|
|
|
|
EOF
|
2015-04-02 13:49:16 +00:00
|
|
|
|
|
|
|
|
2015-04-04 09:15:19 +00:00
|
|
|
echo "Hi" | run_test ${lnav_test} -d /tmp/lnav.err -nt -w logfile_stdin.log
|
2015-04-02 13:49:16 +00:00
|
|
|
|
|
|
|
check_output "piping to stdin is not working?" <<EOF
|
|
|
|
2013-06-06T19:13:20.123 Hi
|
|
|
|
2013-06-06T19:13:20.123 ---- END-OF-STDIN ----
|
|
|
|
EOF
|