This is not really a Perl question, although you could probably come up with a Perl solution.
However, I'd suggest instead a non-Perl solution may be more appropriate. It is possible to configure syslog on your unix server to send all syslog messages to an external server, which can be your windows server.
See man syslogd (search for remote logging), and Kiwi Syslog Daemon for an example of a Windows Syslog Daemon.
Hope this helps,
Darren | [reply] [d/l] |
Sounds like a job for Net::SSH2 (assuming the nix box makes ssh available). I guess that Net::Telnet (and maybe even Net::FTP) are also candidates - again depending upon what the unix box makes available.
At home, I just use IO::Socket::INET client and server (perl) scripts to transfer/read files between linux and win32 boxes - but that solution assumes access to *both* boxes.
If you like to provide some details regarding how you "do this manually", someone might be able to provide more definitive information.
Cheers, Rob | [reply] |
This is how I do this manually.
1. From my desktop which is windows bix using putty, I login to linux server with SSH.
2. Then browse to logs folder and with follwoing command
"grep -i ERROR abc.log >> /tmp/error.txt" write the log to txt file.
3. Then using winscp i transfer this file back to my desktop.
How can I automate this process?
| [reply] |
Essentially that boils down to a run of "ssh <host> '<read file in certain time range>' > save" on Windows (don't know enough|care about output and input redirection on Windows right now).
You could put some command on Unix host which takes time range and spits out the log contents in that range on the standard output -- which would fill the "<read file in certain time range>" bit.
| [reply] [d/l] [select] |
If the Unix box does have an ssh server you should be able to use the scp command to copy files from it. I think the easiest way to do this is to install Cygwin on the Windows box. That also gives you the choice of installing Cygwin's ports of ssh/scp, cron and bash... and even perl. In my experience, Cygwin perl seems a bit closer to typical Unix perl than ActivePerl, especially in terms of being able to install CPAN modules and have them work. | [reply] |