#!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; my $lines = 20; my $logfile = '/var/log/mythtv/mythbackend.log'; if(param('lines')) { $lines = param('lines'); } if(param('logfile')) { if((param('logfile') eq '/var/log/mythtv/mythbackend.log') || (param('logfile') eq '/var/log/mythtv/mythfrontend.log')) { $logfile=param('logfile'); } } my $log = `tail -n $lines $logfile`; my $q = new CGI; print $q->header(), $q->start_html('Log Viewer'), $q->start_form(), "Viewing ", $q->popup_menu({-name=>'lines',-values=>['20','50','100','250','500']}), " lines of ", $q->popup_menu({-name=>'logfile',-values=>['/var/log/mythtv/mythbackend.log','/var/log/mythtv/mythfrontend.log']}), $q->submit({-value=>'Change'}), $q->end_form(), $q->br(), $q->br(), $q->pre($log), $q->end_html();