Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Thomson 585 and Event logs  (Read 3709 times)

renluop

  • Kitizen
  • ****
  • Posts: 3326
Thomson 585 and Event logs
« on: March 15, 2011, 10:15:18 AM »

AFAICS the event logs view is limited as to time. Is there any method by which data can either be retained in the visible log for longer, or permanrntly retained in some sort of srchive file for subsequent viewing?
Logged

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 43613
  • Penguins CAN fly
    • DSLstats
Re: Thomson 585 and Event logs
« Reply #1 on: March 15, 2011, 10:22:10 AM »

Does the web interface offer an option to email the logs to you?
Logged
  Eric

renluop

  • Kitizen
  • ****
  • Posts: 3326
Re: Thomson 585 and Event logs
« Reply #2 on: March 15, 2011, 07:32:52 PM »

 Seems not having searched several options.
Logged

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 43613
  • Penguins CAN fly
    • DSLstats
Re: Thomson 585 and Event logs
« Reply #3 on: March 15, 2011, 08:29:12 PM »

I can't think of another simple option unfortunately. Thomson routers tend to offer rather limited facilities in their web interfaces. If the version you have supports telnet access, you can possibly do what you want that way, if you can find your way around the commands.
Logged
  Eric

geep

  • Reg Member
  • ***
  • Posts: 452
    • My ST546 Statistics
Re: Thomson 585 and Event logs
« Reply #4 on: March 15, 2011, 08:56:45 PM »

Quote
or permanrntly retained in some sort of srchive file for subsequent viewing?
The answer is yes. Write a Perl script to get data either via telnet or wget and stuff it into a file periodically.
Parse it into a suitable format with a timestamp on each line. If you end up with duplicate records you can get rid of them using a sort which removes duplicates. Perl should run OK on either Linux, Windows or Mac.

Give me a few minutes and I might even post a basic Perl script to do it.

Cheers,
Peter

Added: On my ST546 this URL takes me to the event log http://192.168.1.254/cgi/b/events/?be=0&l0=0&l1=2
What is the URL for your event log?

Added #2:
As an alternative, if you know the telnet command to see the event log then that could also be embedded in a Perl script.

I found the attached script somewhere, but I don't know where. I use it as the basis for logging some data from my Thomson ST546. It seems unfortunate that the event log web page doesn't show an absolute time. Anyway, to get the event log to stdout on my PC I would give the command:
Code: [Select]
./html2txt.pl http://192.168.1.254/cgi/b/events/?be=0&l0=0&l1=2
The Perl script is:
Code: [Select]
#!/usr/bin/perl

# html2txt
#
# Copyright (c) 2002 Matti J. Kärki <mjk@iki.fi>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
#
# HTML to text converter.
#
# This Perl script converts an HTML string from file/socket/stdin
# to stdout as a plain text.

use FileHandle;
use Socket;
use strict;
use warnings;

# html2text(string)
#
# string is a html string.
# Function returns a formatted text string.
#
sub html2text {
my $str = shift(@_);

$str =~ s/HTTP.*?\n//sg;# Remove all HTTP headers.
$str =~ s/\n//sg; # Remove all obsolete newlines.

# Link:
$str =~ s/<a[ ]+.*?>(.+)<\/a>/$1/ig;

# Script:
$str =~ s/<script>(.+)<\/script>/$1/ig;

# Comment:
$str =~ s/<!--.*?-->//ig;

# Title:
$str =~ s/<\/title>/\n\n/ig;

# Line break:
$str =~ s/<br>/\n/ig;

# Horizontal line:
$str =~ s/<hr>/\n---*-*-*---\n/ig;

# Paragraph:
$str =~ s/<\/?p[ ]*.*?>/\n\n/ig;

# Headings:
$str =~ s/<\/?h[1-6][ ]*.*?>/\n\n/ig;

# List items:
$str =~ s/<\/?li[ ]*.*?>/\n/ig;

# Table:
$str =~ s/<\/?table[ ]*.*?>/\n/ig;
$str =~ s/<td[ ]*.*?>/\t/ig;
$str =~ s/<tr[ ]*.*?>/\n/ig;

# Cleaning up:
$str =~ s/<.*?>//sg; # Remove all tags.
$str =~ s/\n[ ]+\n/\n\n/sg; # Remove all obsolete spaces.
$str =~ s/\n[ ]+/\n/sg;
$str =~ s/\n{2,}/\n\n/sg; # Remove all obsolete newlines.
$str =~ s/^[ ]*//g; # Remove all leading spaces (again).
$str =~ s/[ ]+/ /g; # Remove all duplicate spaces (again).

# Decode some commonly used special characters:
$str =~ s/&nbsp;/ /g; # Non-breaking space
$str =~ s/&shy;/-/g; # Hyphen
$str =~ s/&lt;/</g; # <
$str =~ s/&gt;/>/g; # >
$str =~ s/&amp;/&/g; # &
$str =~ s/&quot;/\"/g; # "
$str =~ s/&copy;/(c)/g; # Copyright
$str =~ s/&reg;/(r)/g; # Reg.tm.
$str =~ s/&aring;/å/g; # å
$str =~ s/&auml;/ä/g; # ä
$str =~ s/&ouml;/ö/g; # ö
$str =~ s/&Aring;/Å/g; # Å
$str =~ s/&Auml;/Ä/g; # Ä
$str =~ s/&Ouml;/Ö/g; # Ö

return $str;
}

# geturl(string)
#
# string is an url or file path.
# Function returns a list where the first argument is a host name and
# the second argument is a path.
#
sub geturl {
my $str = shift(@_);
my $url = "";
my $path = "/";

if ($str =~ /http:/) {
if ($str =~ /\/\/(.+?)\//) {
$url = $1;
}
if ($str =~ /\/\/.+?(\/.+)/) {
$path = $1;
}
}
elsif ($str =~ /file:/) {
if ($str =~ /\/\/(.+)/) {
$url = "file";
$path = $1;
}
}

return ($url, $path);
}

# geturlhandle(url, path)
#
# Function returns a handle.
#
sub geturlhandle {
my $url = shift(@_);
my $path = shift(@_);

my $proto = getprotobyname('tcp');
socket(my $HANDLE, PF_INET, SOCK_STREAM, $proto);
my $iaddr = gethostbyname($url);
my $port = getservbyname('http', 'tcp');
my $in = sockaddr_in($port, $iaddr);
connect($HANDLE, $in);

$HANDLE->autoflush(1);
print $HANDLE "GET $path HTTP/1.0\r\nhost: $url\r\n\r\n";

return $HANDLE;
}

# getfilehandle(filename)
#
# Function returns a handle.
#
sub getfilehandle {
my $name = shift(@_);

open my $HANDLE, $name or die "Getfilehandle: $!";

return $HANDLE;
}

# fetchpage(handle)
#
# Function reads everything from the handle and returns a string.
#
sub fetchpage {
my $handle = shift(@_);
my $doc = "";
my $line = "";

while ($line = <$handle>) {
$line =~ s/\r//g; # Remove all \r characters.
chomp($line); # Remove all newlines.
($line = "\n") if (length($line) == 0); # A dirty hack.
$line =~ s/\t/ /g; # Remove all tabs.
$line =~ s/[ ]+/ /g; # Remove all duplicate spaces.
$line =~ s/^[ ]*//g; # Remove all leading spaces.
$line =~ s/[ ]*$//g; # Remove all trailing spaces.
$doc .= " $line";
}
close $handle;

return $doc;
}

# Main function.
#
sub main {
my $argc = shift(@_);
my @argv = shift(@_);

if ($argc > 0) {
my @url = geturl($argv[0]);
if ($url[0] eq "") {
print "Syntax:\n\n" .
"From file:" .
"\thtml2txt file://fullpath.txt\n" .
"From web:" .
"\thtml2txt http://www.foo.xy/\n" .
"From stdin:" .
"\thtml2txt\n";
}
elsif ($url[0] eq "file") {
my $doc = fetchpage(getfilehandle($url[1]));
print((html2text $doc) . "\n");
}
else {
my $doc = fetchpage(geturlhandle($url[0], $url[1]));
print((html2text $doc) . "\n");
}
}
else {
my $string = join('', <STDIN>);
print ((html2text $string) . "\n");
}
}

# This calls the main function.
#
main($#ARGV + 1, @ARGV);

# EOF


The result on my PC is:
Code: [Select]
./html2txt.pl http://192.168.1.254/cgi/b/events/?be=0&l0=0&l1=2
[2] 6587                                                                            
[3] 6588                                                                            
[3]+  Done                    l0=0                                                  
dad@dad:~/event.log$ SpeedTouch - Event Logs                                        

var g_navitem = -1; var g_focus = -1;

Thomson - SpeedTouch

To view the Web interface of the SpeedTouch, JavaScript must be supported and enabled on your browser!

Please enable scripting and refresh your browser.

        

        THOMSON ST546    
                        

                                
                                

                



         writeMenu();    
writeNavBar();          
                        

         pm_write_messages();
---*-*-*---                  

        

        Event Logging    
                        

This page summarizes the last events that have been recorded on your SpeedTouch. Choose a display filter...

                

                                
                                
        Category:        All Connections LAN UPnP Security System Service

                 Recorded Events





TimeMessage






                04 days 03:32:32 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:32:32 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:32:01 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:32:02 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:31:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:31:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:31:01 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:31:01 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:30:37 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:30:36 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:30:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:30:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:30:02 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:30:02 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:29:32 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:29:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:29:02 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:29:01 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:28:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:28:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:28:02 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:28:02 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:27:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:27:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:27:02 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:27:01 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:26:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:26:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:26:02 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:26:01 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:25:31 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




                04 days 03:25:31 (since last boot)      LOGIN User logged in on TELNET (192.168.1.65)




                04 days 03:25:01 (since last boot)      LOGOUT User logged out on TELNET (192.168.1.65)




generateTasks()



[2]+  Done                    ./html2txt.pl http://192.168.1.254/cgi/b/events/?be=0

The script also runs on Windows. I tested it on Vista using ActivePerl 5.12 - it's free for the Community Edition. I created a .bat file with the following command in it (omitting the final &l0=0&l1=2 which Windows doesn't seem to like):
Code: [Select]
perl html2txt.pl http://192.168.1.254/cgi/b/events/?be=0
« Last Edit: March 15, 2011, 10:33:19 PM by geep »
Logged

renluop

  • Kitizen
  • ****
  • Posts: 3326
Re: Thomson 585 and Event logs
« Reply #5 on: March 16, 2011, 07:07:36 AM »

@geep
Thanks, I shall have to read carefully and try to get brain to understand ;D
Event log url is http://192.168.1.254/cgi/b/events/?be=0&l0=1&l1=2.
I do not know telnet command and wrting scripts is new to me and I am not very sure that with aging eyesight it will not be a touch and oh expereince. ;)
Logged

geep

  • Reg Member
  • ***
  • Posts: 452
    • My ST546 Statistics
Re: Thomson 585 and Event logs
« Reply #6 on: March 16, 2011, 02:39:42 PM »

Assuming you're on Windows all you need to do is install ActivePerl 5.12 from http://www.activestate.com/activeperl/downloads. Just download the right one for your operating system ! Then in Windows Explorer right-click on the icon for the downloaded .msi file and select the Install option.

Then copy & paste the Perl script into Notepad and save the file as html2txt.pl

Create the .bat file to run the command - just copy and paste
Code: [Select]
perl html2txt.pl http://192.168.1.254/cgi/b/events/?be=0into Notepad and save as log.bat. It's important that this file is in the same folder as html2txt.pl.

To run it, just open a command line Window - using the command cmd
Navigate to the folder where you put html2txt.pl and log.bat.
In the command line window give this command: log.bat
To save the results in a file: log.bat > results.txt
To append to existing results file: log.bat >> results.txt

Perl isn't perhaps the easiest scripting language, but you shouldn't have to change anything.
Maybe Python is simpler to learn, but by chance I found an existing Perl script as the starting point for writing my own
ST546 logging software. And since then I've gradually learnt more and more about Perl.

Cheers,
Peter


Logged
 

anything