Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-09

linux ques

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Aviles

I have been task to write a routing for a web server running apache under linux that will basically have the same functionality as a tail -f /var/log/messages. I guess since the web server account does not have access to those files, there must be some type of listener/socket written to accomplish this. The goal is to be able to view log files in real time using a browser instead of a telnet or ssh session. Any ideas out there?

Thanks

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

Reply by email

Michael Van Canneyt
to Paul Aviles
Paul Aviles wrote 6 lines
I have been task to write a routing for a web server running apache under linux that will basically have the same functionality as a tail -f /var/log/messages. I guess since the web server account does not have access to those files, there must be some type of listener/socket written to accomplish this. The goal is to be able to view log files in real time using a browser instead of a telnet or ssh session. Any ideas out there?

A unix socket should do it.
In the server, keep the last N lines in memory, keep scanning for more lines. (use Poll or Select for this)
Client connects.
Client asks for M lines.
Server writes last M (<=N) lines.

This should be a simple modification of the client/server demo. If you use the async event loop, it should be even easier.

Michael.

Reply by email