|
-
Perl: Continuous tail through ssh back to CGI
Had a request to do a script recently for work in which they want a tail of the logs on one of the servers to be thrown into an html page to be viewed on another machine. This seemed a fairly easy task just using net::ssh and net::scp to tail the file and pipe it into another then grab the result with scp.
What I found out today was that what is requested is that the log be put on a continuous tail and they want this to be outputted continuously to the other machine. Has anyone ever tried this before or something similar that might have some pointers on which direction I should set out on to accomplish this?
Thanks, Vin
Insert ancient Sharky sig here
[
Prince Vindir of the OC Crusaders
Holding Boundaries and Breaking Barriers
]
-
Catfish
I'm not sure precisely what you are asking for. I detailed use case would help us here.
If you mean "outputted to another machine" to physically copy a file, then rcp (remote copy) is your friend. ftp might work too.
If you mean that the web browser keeps updaing, isn't there an auto-refresh command for html? Just use that to reload your web page, which should re-execute your script and allow you to take another tail.
If you mean update continously to mean that the page updates the instant it hits the log file (as opposed to the auto-refresh which might update every 5 minutes or so), then I dunno. That's kinda unreasonable, find better customers. But you might be able to make something in Java which acts like a chat client. On the other end, look at the system logger deamon (oops, unix only, I dunno about Win32) man page and see if there's a way to remotely collect statistics. There *might* be, it's pretty versitile.
P.S. Just what OSs are we talking here anyway? And what client does the browser run on?
-
Originally posted by gameboy1234
I'm not sure precisely what you are asking for. I detailed use case would help us here.
If you mean "outputted to another machine" to physically copy a file, then rcp (remote copy) is your friend. ftp might work too.
If you mean that the web browser keeps updaing, isn't there an auto-refresh command for html? Just use that to reload your web page, which should re-execute your script and allow you to take another tail.
If you mean update continously to mean that the page updates the instant it hits the log file (as opposed to the auto-refresh which might update every 5 minutes or so), then I dunno. That's kinda unreasonable, find better customers. But you might be able to make something in Java which acts like a chat client. On the other end, look at the system logger deamon (oops, unix only, I dunno about Win32) man page and see if there's a way to remotely collect statistics. There *might* be, it's pretty versitile.
P.S. Just what OSs are we talking here anyway? And what client does the browser run on?
They are BSD and Linux boxes currently though it might be used on some of the Solaris boxes if needed. Apologies for leaving out some of the more important details. The only option for connecting to these machines is through ssh as they are dedicated to the news hosting, no other ports are open or will be opened for daemons, rcp is out and scp is my buddy, but it would be nice to cut out the scp regardless to push it straight to the page. By continuously output I meant they want the script to connect and run a tail -f that updates as each line enters the log and they wanted it to scroll to the page that the team will be reading the logs from. The log updates closer to several times every second as they are under heavy load from users. As to the refresh that is what I originally expected to do, just hoping there might be some way to fill their request as wished.
Insert ancient Sharky sig here
[
Prince Vindir of the OC Crusaders
Holding Boundaries and Breaking Barriers
]
-
Catfish
Originally posted by Vindir
They are BSD and Linux boxes currently though it might be used on some of the Solaris boxes if needed. Apologies for leaving out some of the more important details. The only option for connecting to these machines is through ssh as they are dedicated to the news hosting, no other ports are open or will be opened for daemons, rcp is out and scp is my buddy, but it would be nice to cut out the scp regardless to push it straight to the page. By continuously output I meant they want the script to connect and run a tail -f that updates as each line enters the log and they wanted it to scroll to the page that the team will be reading the logs from. The log updates closer to several times every second as they are under heavy load from users. As to the refresh that is what I originally expected to do, just hoping there might be some way to fill their request as wished.
Ooookay... tail -f then what? Pipe to your perls script? That's not CGI, CGI runs on a web server like IIS or Apache. It's just a script.
So then this output goes to where? A file on some other machine? Then what happens? Does this file on another machine get read by something? How do you know when the file gets updated? Is this the machine with the web server and the CGI?
Then what? Next to a browser? So some monkey can pretend to read a log that updates SEVERAL TIMES A SECOND? Yikes, your jobs sucks. At least recomend that they develop some scripts to filter the logs so only the important stuff gets looked at. I don't think a web broswer is the correct answer here, but if they are paying for it...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|