Last active
October 18, 2021 22:05
Revisions
-
Generator revised this gist
Sep 7, 2013 . 1 changed file with 11 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,11 @@ ## DD-WRT Log HTML generator ## Instructions: ## put script in /tmp/www/ ## chmod 700 /tmp/www/log_gen.sh ## Add cron job in Administrations panel ## */15 * * * * root /tmp/www/log_gen.sh ## Page available in http://<routerip>/user/syslog.html ## Change nline for number of generated lines # Options nlines="500" @@ -19,36 +20,32 @@ date=$(date) tail -n $nlines $in | awk -v NAME="$name" -v DATE="$date" 'BEGIN { print "<html><title>"NAME" - Syslog</title>" print "<head><style type=\"text/css\"> \ body, td { font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #ffffff;} \ td.hd { font-weight: bold; background-color: #f5f5f5;} \ </style></head>" print "<center><b>System Log</b><br>(Generated: "DATE")<br><br><table border=1 cellspacing=\"0\" cellpadding=\"1\">" print "<tr><td class=\"hd\">Date/Time</td><td class=\"hd\">Severity</td><td class=\"hd\">Messages</td></tr>" } { if ( $5 ~ /.crit/ || $5 ~ /.alert/ || $5 ~ /.err/ ) COLOR="red"; else COLOR="#5f5f5f"; print "<tr>" print "<td>"$1" "$2" "$3"</td>" print "<td style=\"color:"COLOR";\">"$5"</td>" print "<td>" } { for (i=6; i<NF; i++) printf $i " "; print $NF; } END { print "</td></tr>" print "</table></center>" print "</html>" }' > $out -
Generator revised this gist
Sep 6, 2013 . 1 changed file with 11 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,17 @@ ## */15 * * * * root /tmp/www/log_gen.sh ## Page available in http://<routerip>/user/syslog.html # Options nlines="500" in="/var/log/messages" out="/tmp/www/syslog.html" # Leave me alone name=$(nvram get router_name); date=$(date) tail -n $nlines $in | awk -v NAME="$name" -v DATE="$date" 'BEGIN { print "<html><title>"NAME" - Syslog</title>" print "<head><style type=\"text/css\"> \ body { font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #ffffff;} \ @@ -20,18 +26,18 @@ tail -n 1000 $in | awk 'BEGIN { td.hd { font-weight: bold; font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #f5f5f5;} \ </style></head>" print "<center><b>System Log</b><br>(Generated: "DATE")<br><br><table border=1 cellspacing=\"0\" cellpadding=\"1\">" print "<tr bgcolor=#F5F5F5><td class=\"hd\">Date/Time</td><td class=\"hd\">Severity</td><td class=\"hd\">Messages</td></tr>" } { if ( $5 == "user.crit" || $5 == "user.emerg" ) color="red"; else COLOR="black"; print "<tr>" print "<td><font color=black>"$1" "$2" "$3"</font></td>" print "<td><font color="COLOR">"$5"</font></td>" print "<td><font color=black>" } -
Generator revised this gist
Sep 6, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ ## chmod 744 /tmp/www/log_gen.sh ## Add cron job in Administrations panel ## */15 * * * * root /tmp/www/log_gen.sh ## Page available in http://<routerip>/user/syslog.html in="/var/log/messages" out="/tmp/www/syslog.html" -
Generator created this gist
Sep 6, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ #!/bin/sh ## DD-WRT Log HTML generator ## Instructions: ## put script in /tmp/www/ ## chmod 744 /tmp/www/log_gen.sh ## Add cron job in Administrations panel ## */15 * * * * root /tmp/www/log_gen.sh in="/var/log/messages" out="/tmp/www/syslog.html" tail -n 1000 $in | awk 'BEGIN { print "<html><title>Syslog</title>" print "<head><style type=\"text/css\"> \ body { font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #ffffff;} \ td { font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #ffffff;} \ td.hd { font-weight: bold; font-size: 12px; font-family: \"tahoma\", \"sans-serif\", \"arial\", \"helvetica\"; \ color: #5f5f5f; background-color: #f5f5f5;} \ </style></head>" print "<center><b>System Log</b><br><br><table border=1 cellspacing=\"0\" cellpadding=\"1\">" print "<tr bgcolor=#F5F5F5><td class=\"hd\">Date/Time</td><td class=\"hd\">Severity</td><td class=\"hd\">Messages</td></tr>" } { if ( $5 == "user.crit" || $5 == "user.emerg" ) color="red"; else color="black"; print "<tr>" print "<td><font color=black>"$1" "$2" "$3"</font></td>" print "<td><font color="color">"$5"</font></td>" print "<td><font color=black>" } #Print Messages { for (i=6; i<NF; i++) printf $i " "; print $NF; } END { print "</font></td></tr>" print "</table></center>" print "</html>" }' > $out