#! /bin/bash lnav_test="${top_builddir}/src/lnav-test" run_test ${lnav_test} -n \ -c ";select * from access_log" \ -c ':write-csv-to -' \ ${test_dir}/logfile_access_log.0 check_output "access_log table is not working" <,/vmw/cgi/tramp,gPXE/0.9.7,-,HTTP/1.0,134,200 1,p.0,2009-07-20 22:59:29.000,3000,error,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkboot.gz,gPXE/0.9.7,-,HTTP/1.0,46210,404 2,p.0,2009-07-20 22:59:29.000,0,info,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkernel.gz,gPXE/0.9.7,-,HTTP/1.0,78929,200 EOF run_test ${lnav_test} -n \ -c ";select * from access_log where log_level >= 'warning'" \ -c ':write-csv-to -' \ ${test_dir}/logfile_access_log.0 check_output "loglevel collator is not working" <,/vmw/vSphere/default/vmkboot.gz,gPXE/0.9.7,-,HTTP/1.0,46210,404 EOF # XXX The timestamp on the file is used to determine the year for syslog files. touch -t 201311030923 ${test_dir}/logfile_syslog.0 run_test ${lnav_test} -n \ -c ";select * from syslog_log" \ -c ':write-csv-to -' \ ${test_dir}/logfile_syslog.0 check_output "syslog_log table is not working" <,sudo EOF run_test ${lnav_test} -n \ -c ";select * from syslog_log where log_time >= datetime('2013-11-03T09:47:02.000')" \ -c ':write-csv-to -' \ ${test_dir}/logfile_syslog.0 check_output "log_time collation is wrong" <,sudo EOF run_test ${lnav_test} -n \ -c ':filter-in sudo' \ -c ";select * from logline" \ -c ':write-csv-to -' \ ${test_dir}/logfile_syslog.0 check_output "logline table is not working" <,sudo,timstack,pts/6,/auto/wstimstack/rpms/lbuild/test,root,/usr/bin/tail /var/log/messages EOF run_test ${lnav_test} -n \ -c ";update access_log set log_mark = 1 where sc_bytes > 60000" \ -c ':write-to -' \ ${test_dir}/logfile_access_log.0 check_output "setting log_mark is not working" <,/vmw/cgi/tramp,gPXE/0.9.7,-,HTTP/1.0,134,200 1,middle,2009-07-20 22:59:29.000,3000,error,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkboot.gz,gPXE/0.9.7,-,HTTP/1.0,46210,404 2,middle,2009-07-20 22:59:29.000,0,info,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkernel.gz,gPXE/0.9.7,-,HTTP/1.0,78929,200 EOF run_test ${lnav_test} -n \ -c ":goto 1" \ -c ":partition-name middle" \ -c ":clear-partition" \ -c ";select * from access_log" \ -c ":write-csv-to -" \ ${test_dir}/logfile_access_log.0 check_output "clear-partition does not work" <,/vmw/cgi/tramp,gPXE/0.9.7,-,HTTP/1.0,134,200 1,p.0,2009-07-20 22:59:29.000,3000,error,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkboot.gz,gPXE/0.9.7,-,HTTP/1.0,46210,404 2,p.0,2009-07-20 22:59:29.000,0,info,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkernel.gz,gPXE/0.9.7,-,HTTP/1.0,78929,200 EOF run_test ${lnav_test} -n \ -c ":goto 1" \ -c ":partition-name middle" \ -c ":goto 2" \ -c ":clear-partition" \ -c ";select * from access_log" \ -c ":write-csv-to -" \ ${test_dir}/logfile_access_log.0 check_output "clear-partition does not work when in the middle of a part" <,/vmw/cgi/tramp,gPXE/0.9.7,-,HTTP/1.0,134,200 1,p.0,2009-07-20 22:59:29.000,3000,error,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkboot.gz,gPXE/0.9.7,-,HTTP/1.0,46210,404 2,p.0,2009-07-20 22:59:29.000,0,info,0,192.168.202.254,GET,-,,/vmw/vSphere/default/vmkernel.gz,gPXE/0.9.7,-,HTTP/1.0,78929,200 EOF