diff options
Diffstat (limited to 'logdrake')
-rwxr-xr-x | logdrake | 81 |
1 files changed, 32 insertions, 49 deletions
@@ -106,25 +106,25 @@ my $cyan = my_gtk::gtkcolor(0x0, 0x9898, 0x9898); my $darkgray = my_gtk::gtkcolor(0x2F2F, 0x4F4F, 0x4F4F); - # Define global terms: - # Define good notables: - my @word_good=("starting\n", "Freeing", "Detected", "starting.", "accepted.\n", "authenticated.\n", "Ready", "active", "reloading", "saved;", "restarting", "ONLINE\n"); - my @word_warn=("dangling", "closed.\n", "Assuming", "root", "root\n", "exiting\n", "missing", "Ignored", "adminalert:", "deleting", "OFFLINE\n"); - my @word_bad=("bad"); +# Define global terms: +# Define good notables: +my @word_good=("starting\n", "Freeing", "Detected", "starting.", "accepted.\n", "authenticated.\n", "Ready", "active", "reloading", "saved;", "restarting", "ONLINE\n"); +my @word_warn=("dangling", "closed.\n", "Assuming", "root", "root\n", "exiting\n", "missing", "Ignored", "adminalert:", "deleting", "OFFLINE\n"); +my @word_bad=("bad"); my @word_note=("LOGIN", "DHCP_OFFER", "optimized", "reset:", "unloaded", "disconnected", "connect", "Successful", "registered\n"); - my @line_good=("up", "DHCP_ACK", "Cleaned", "Initializing", "Starting", "success", "successfully", "alive", "found", "ONLINE\n"); - my @line_warn=("warning:", "WARNING:", "invalid", "obsolete", "bad", "Password", "detected", "timeout", "timeout:", "attackalert:", "wrong", "Lame", "FAILED", "failing", "unknown", "obsolete", "stopped.\n", "terminating.", "disabled\n", "disabled", "Lost"); - my @line_bad=("DENY", "lost", "shutting", "dead", "DHCP_NAK", "failure;", "Unable", "inactive", "terminating", "refused", "rejected", "down", "OFFLINE\n", "error\n", "ERROR\n", "ERROR:", "error", "ERROR", "error:", "failed:"); - - # Define specifics: - my @daemons=("named"); - - # Now define what we want to use when: - my $col_good = $green; - my $col_warn = $yellow; - my $col_bad = $red; - my $col_note = $purple; - my $col=$cyan; +my @line_good=("up", "DHCP_ACK", "Cleaned", "Initializing", "Starting", "success", "successfully", "alive", "found", "ONLINE\n"); +my @line_warn=("warning:", "WARNING:", "invalid", "obsolete", "bad", "Password", "detected", "timeout", "timeout:", "attackalert:", "wrong", "Lame", "FAILED", "failing", "unknown", "obsolete", "stopped.\n", "terminating.", "disabled\n", "disabled", "Lost"); +my @line_bad=("DENY", "lost", "shutting", "dead", "DHCP_NAK", "failure;", "Unable", "inactive", "terminating", "refused", "rejected", "down", "OFFLINE\n", "error\n", "ERROR\n", "ERROR:", "error", "ERROR", "error:", "failed:"); + +# Define specifics: +my @daemons=("named"); + +# Now define what we want to use when: +my $col_good = $green; +my $col_warn = $yellow; +my $col_bad = $red; +my $col_note = $purple; +my $col=$cyan; ######### font and colors end @@ -137,11 +137,11 @@ $::isEmbedded or $global_vbox->pack_start (new Gtk::Label(_("see your log")), 0, ### the tree - -# Create a ScrolledWindow for the tree +my $tree_frame = new Gtk::Frame(_("Choose file")); my $tree_scrolled_win = new Gtk::ScrolledWindow(); -#$tree_scrolled_win->set_usize(300, $::isEmbedded ? 0 : 175); -$global_vbox->pack_start( $tree_scrolled_win,0,0,0 ); +$tree_scrolled_win->set_usize(300, $::isEmbedded ? 0 : 175); +$tree_frame->add($tree_scrolled_win); +$global_vbox->pack_start($tree_frame,0,0,0 ); $tree_scrolled_win->set_policy('automatic', 'automatic'); # Create root tree @@ -163,8 +163,6 @@ $log_hbox->pack_start($vscrollbar, 0, 0, 0 ); $log_frame->add($log_hbox); $global_vbox->pack_start($log_frame, 0, 0, 0); - $log->insert($b,$yellow, undef,"meuhgyyyyyyyy\n"); - ### back to window $window->add($global_vbox); $window->show_all(); @@ -260,17 +258,14 @@ sub log_output { ########################################################################################## sub logcolorize { - my ($thisline)=@_; - + # we get date & time if it is date & time (dmesg) - s/(\D{3} \d{2} \d\d:\d\d:\d\d )//; + s/(\D{3} .. \d\d:\d\d:\d\d )//; $timestamp=$1; - @rec = split; log_output($cyan,$timestamp,$b); # date & time log_output(($rec[0] eq $h) ? $blue : $col,"$rec[0] ",$b); # hostname - if ($rec[1] eq "last") { log_output($green," last message repeated ",$n); @@ -300,26 +295,11 @@ sub logcolorize { foreach (@word_bad) { $col=$col_bad if ($_ eq $rec[$therest]);} foreach (@word_note) { $col=$col_note if ($_ eq $rec[$therest]);} -# # Watch for words that indicate entire lines should be highlighted -# for ($i=0; $i<=$#line_good; $i++) { -# if ($line_good[$i] eq $rec[$therest]) { -# $restcolor="$col_norm$col_good"; -# $restoftheline.="$col_brighten$col_good"; $highlight=1; -# } -# } -# for ($i=0; $i<=$#line_warn; $i++) { -# if ($line_warn[$i] eq $rec[$therest]) { -# $restcolor="$col_norm$col_warn"; -# $restoftheline.="$col_brighten$col_warn"; $highlight=1; -# } -# } -# for ($i=0; $i<=$#line_bad; $i++) { -# if ($line_bad[$i] eq $rec[$therest]) { -# $restcolor="$col_norm$col_bad"; -# $restoftheline.="$col_brighten$col_bad"; $highlight=1; -# } -# } - + # Watch for words that indicate entire lines should be highlighted + foreach (@line_good) { $col=$col_good if ($_ eq $rec[$therest]);} + foreach (@line_warn) { $col=$col_warn if ($_ eq $rec[$therest]);} + foreach (@line_bad) { $col=$col_bad if ($_ eq $rec[$therest]);} + log_output($col,"$rec[$therest] ",$n); } log_output($black,"\n",$n); @@ -383,6 +363,9 @@ sub destroy_window { # log # $Log$ +# Revision 1.4 2001/07/02 09:47:55 yduret +# fix bug in regexp +# # Revision 1.3 2001/06/29 16:14:01 yduret # great upgrade # |