473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Tail a logfile to a web page

I want to be able to view log files on web page and want to know what
the options are for dynamically updating the log output without
having to refresh the page. Basically have it behave like
"tail -f some.log".

I tried a java applet to display the log output from a TCP stream and
it works nicely, but then I discovered that the latest MS browers
don't come with java support and I prefer to do this without making
the user install any extra plugins. Hmmm.

Any ideas?
Jul 24 '05 #1
10 14174
Dan Olson wrote:
I want to be able to view log files on web page and want to know what
the options are for dynamically updating the log output without
having to refresh the page. Basically have it behave like
"tail -f some.log".

I tried a java applet to display the log output from a TCP stream and
it works nicely, but then I discovered that the latest MS browers
don't come with java support and I prefer to do this without making
the user install any extra plugins. Hmmm.

Any ideas?


You could output the lines from the log file as they come in to the browser,
flushing the stream after every line (without closing the connection). A
browser that displays the page incrementially, should reproduce the desired
behaviour.

But this is a server side issue - not related to HTML. You should ask in a
group about CGI or PHP for more details.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 24 '05 #2
Dan Olson wrote:

I want to be able to view log files on web page and want to know what
the options are for dynamically updating the log output without
having to refresh the page. Basically have it behave like
"tail -f some.log".

I tried a java applet to display the log output from a TCP stream and
it works nicely, but then I discovered that the latest MS browers
don't come with java support and I prefer to do this without making
the user install any extra plugins. Hmmm.


I assume you are creating the Web page's HTML dynamically from the
log file via some kind of script operating outside the Web page.

In the HEAD section of the generated HTML file, include the
following line:
<meta http-equiv="Refresh" content="nn">
where nn is some integer. The page will refresh every nn seconds.

See <URL:http://cad.chp.ca.gov/>. The middle frame has nn=30.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Jul 24 '05 #3
David Ross <no****@nowhere.not> writes:
I assume you are creating the Web page's HTML dynamically from the
log file via some kind of script operating outside the Web page.
Yes. Basically I'm going down the path of using a web based interface
embedded in a network device for setup and monitoring. As opposed to
the good old RS232 or telnet console interface. Anyway, I'm more of
an embedded software developer so am not familiar with all the
different techniques usable with a web browser. A HTML interface
seemed nice in that the end user doesn't need to install any software
on their computer to configure and monitor the device I'm working on.
In the HEAD section of the generated HTML file, include the
following line:
<meta http-equiv="Refresh" content="nn">
where nn is some integer. The page will refresh every nn seconds.

See <URL:http://cad.chp.ca.gov/>. The middle frame has nn=30.


This sounds like it will work for what I want to do. I'll see if I
can figure out how to use the refresh tag when the browser doesn't
support Java.

--
dano
Jul 24 '05 #4
Dan Olson wrote:

David Ross <no****@nowhere.not> writes:
I assume you are creating the Web page's HTML dynamically from the
log file via some kind of script operating outside the Web page.


Yes. Basically I'm going down the path of using a web based interface
embedded in a network device for setup and monitoring. As opposed to
the good old RS232 or telnet console interface. Anyway, I'm more of
an embedded software developer so am not familiar with all the
different techniques usable with a web browser. A HTML interface
seemed nice in that the end user doesn't need to install any software
on their computer to configure and monitor the device I'm working on.
In the HEAD section of the generated HTML file, include the
following line:
<meta http-equiv="Refresh" content="nn">
where nn is some integer. The page will refresh every nn seconds.

See <URL:http://cad.chp.ca.gov/>. The middle frame has nn=30.


This sounds like it will work for what I want to do. I'll see if I
can figure out how to use the refresh tag when the browser doesn't
support Java.


REFRESH is not a tag. It's a value for a META tag, which in turn
is a substitute for a field on the HTML tag.

This does not require Java. However, not all browsers support
REFRESH. I know that Mozlla and Firefox support it, and I think IE
supports it. If you're not sure about your browser, test it with
my <URL:http://www.rossde.com/get_index.html>. If you get my Index
without selecting the "Go" button, your browser supports REFRESH.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Jul 24 '05 #5
David Ross <no****@nowhere.not> writes:
Dan Olson wrote:
This sounds like it will work for what I want to do. I'll see if I
can figure out how to use the refresh tag when the browser doesn't
support Java.


REFRESH is not a tag. It's a value for a META tag, which in turn
is a substitute for a field on the HTML tag.

This does not require Java. However, not all browsers support
REFRESH. I know that Mozlla and Firefox support it, and I think IE
supports it. If you're not sure about your browser, test it with
my <URL:http://www.rossde.com/get_index.html>. If you get my Index
without selecting the "Go" button, your browser supports REFRESH.


Oh, what my last statement above meant is I want to use a Java applet
when the user's browser supports it because it will show log messages
as they arrive. But I would have an alternate page that uses the
refresh value when the browser does not support Java. Sorry for the
confusion. Also, I expect all my users to be running either a IE or a
Mozilla derivative so I think your technique will work great.

--
dano
Jul 24 '05 #6
David Ross <no****@nowhere.not> writes:
Dan Olson wrote:
This sounds like it will work for what I want to do. I'll see if I
can figure out how to use the refresh tag when the browser doesn't
support Java.
REFRESH is not a tag. It's a value for a META tag, which in turn
is a substitute for a field on the HTML tag.


Wrong. It's a substitute for a HTTP header. (Except that there isn't a
HTTP header "Refresh" in the specification)
This does not require Java. However, not all browsers support
REFRESH. I know that Mozlla and Firefox support it, and I think IE
supports it. If you're not sure about your browser, test it with
my <URL:http://www.rossde.com/get_index.html>. If you get my Index
without selecting the "Go" button, your browser supports REFRESH.


IE *sometimes* supports it. It can be enabled or disabled through the
security zone settings.

--
Chris
Jul 24 '05 #7
On Mon, 11 Jul 2005 10:48:54 -0700, David Ross wrote:
REFRESH is not a tag. It's a value for a META tag, which in turn
is a substitute for a field on the HTML tag.


A small point, but ...

REFRESH (or "Refresh:") is a HTTP header. The META tag is a way to allow
pages to specify values for some HTTP headers.

Rich
Jul 24 '05 #8
On Tue, 12 Jul 2005, Richard Gration wrote:
REFRESH (or "Refresh:") is a HTTP header.
Well, only in as much as the applicable HTTP RFC (2616) allows
arbitrary HTTP headers to be added, even though they're not defined in
the RFC.

Last time I tested, IE doesn't support this HTTP "header". It only
supports the substitute meta. Quaint, really.
The META tag is a way to allow pages to specify values for some HTTP
headers.


I'm afraid that's very misleading. I know of very few web servers
which parse HTML and turn the resulting meta items into real HTTP
headers. And in this case it's far from clear that it would really do
anything constructive.

OK, I admit that *was* originally the intention of meta, but it seems
to have quickly dropped out of the plan, many years ago now. If you
want a server to produce HTTP headers, I'd have to recommend reading
its instructions to find out how to ask it to produce real HTTP
headers (Apache has a number of versatile options for this).

I might add that HTTP headers are something that make good sense with
all kinds of content, such as images, PDF files, plain text, etc.
etc., and are by no means limited to HTML, whereas meta is defined
only for (x)html.

Nowadays, if anything is going to pay attention to meta in HTML, it's
likely to be the client agent. But meantime the other participants in
the web transaction (proxies, web caches etc.) will typically be
disregarding the meta inside the HTML, and honouring only the real
HTTP headers, which can produce a really confusing mess for anyone who
seriously thinks that sticking in a meta is any real substitute for a
real HTTP header.

no offence intended.
Jul 24 '05 #9
*** post for FREE via your newsreader at post.newsfeed.com ***
> "Dan" == Dan Olson <da****@comcast.net> writes:


Dan> I want to be able to view log files on web page and want to know what
Dan> the options are for dynamically updating the log output without
Dan> having to refresh the page. Basically have it behave like
Dan> "tail -f some.log".

Been there. Done that.

<http://www.stonehenge.com/merlyn/PerlJournal/col01.html>

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me****@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----

Jul 24 '05 #10
On Tue, 12 Jul 2005 17:43:55 +0100, Alan J. Flavell wrote:

no offence intended.


None taken. I almost always get corrected on Usenet. Some of it has
actually sunk in ... ;-)

rich
Jul 24 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephen Thorne | last post by:
Decorators have been getting lots of air-time at the moment, but only really the syntax. After a short discussion on irc the other night I decided to download python2.4 from experimental and write...
10
by: Mel | last post by:
i need to create a unix like "tail" function on my site. the question: the text is displayed in a scrolled area and a new line is added at the end and the entire text is scrolled down so that...
1
by: FJ | last post by:
Hi all, I hope someone can help me with the following: I want my database to make a logfile in which it puts the date and time a code is used. The code is triggered by a timer. Every x mins it...
12
by: s99999999s2003 | last post by:
hi I have a file which is very large eg over 200Mb , and i am going to use python to code a "tail" command to get the last few lines of the file. What is a good algorithm for this type of task...
19
by: Kay Schluehr | last post by:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
6
by: roger.lagrilliere | last post by:
Hello, is anyone willing to help me out to setup a logfile. I have a program running in Access, but I want to know the progress of it. It is rather easy I think, but don't know how to handle...
30
by: Chas Emerick | last post by:
I looked around for an ElementTree-specific mailing list, but found none -- my apologies if this is too broad a forum for this question. I've been using the lxml variant of the ElementTree API,...
3
by: sab | last post by:
Hello, I have been working on a python script to parse a continuously growing log file on a UNIX server. The input is the standard in, piped in from the log file. The application works well...
35
by: Muzammil | last post by:
int harmonic(int n) { if (n=1) { return 1; } else { return harmonic(n-1)+1/n; } } can any help me ??
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.