|
Hi to everyone.
The aim of this post is simple: i've a problem that i couldn't solve alone. I'm working in a set of perl scripts to manage and configure a wireless modem (Thomson SpeedTouch st585v6) via telnet. Actually I've been programing many commands using the NET::Telnet 3.03 library for handle telnet commands, and the result has been very satisfactory.
First it connect to a Unix server like this:
my $telnet = new Net::Telnet(Timeout=>20, Errmode=>sub{&error_connect}, Prompt => '/[\$%#>( )*]$/',
+ port=>23);
Then it execute the next command, and save the output in an array @Str.
my <b>@Str=$telnet->cmd("systemlog show"</b>);
and the output must be a stream of chars like this (this output has 211 lines of text):
<85> SysUpTime: 00:00:01 FIREWALL event (1 of 1): created rules
<85> SysUpTime: 00:00:01 FIREWALL event (1 of 1): modified rules
<4> SysUpTime: 00:00:01 KERNEL Cold restart
<6> SysUpTime: 00:00:01 WIRELESS interface turned on.
<85> SysUpTime: 00:00:04 FIREWALL event (1 of 1): enabled rules
<6> SysUpTime: 00:00:12 WIRELESS automatic channel selection done (channel = 1)
<6> SysUpTime: 00:00:13 WIRELESS automatic channel selection done (channel = 1)
<85> SysUpTime: 00:00:14 FIREWALL level changed to Disabled.
<173> SysUpTime: 00:00:30 xDSL linestate up (downstream: 17278 kbit/s, upstream: 783 kbit/s; output
+ Power Down: 15.0 dBm, Up: 0.0 dBm; line Attenuation Down: 5.0 dB, Up: 0.0 dB; snr Margin Down: 16
+.0 dB, Up: 12.5 dB)
...
<37> SysUpTime: 00:22:24 LOGIN User logged in on TELNET (192.168.12.1)
<37> SysUpTime: 00:22:25 LOGOUT User logged out on TELNET (192.168.12.1)
...
<37> SysUpTime: 03 days 00:42:13 LOGIN User logged in on TELNET (192.168.12.1)
BUT... here's my problem: the array @Str save until the 28th line, and the rest i don't know where they are. I need to asign the all output in the @Str array, and to take the last line of this syslog. Please someone help me... i'll be eternally grateful. |