[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Dynamically tail a log an outputing to an updated html page

Posted on 2000-03-15
5
Medium Priority
?
547 Views
Last Modified: 2012-06-27
Can anyone tell me how to dynamically "tail" a file an output it an updating html page in unix.  I was thinking of using a meta refresh or maybe some javascript but can remember how to do it.
Thanks
0
Comment
Question by:mragg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:binkzz
ID: 2622879
You can make the html page refresh every minute easily by using meta tags or just plain javascript, fi:

<body onload=setrefresh();>

<script language=javascript>
  function setrefresh()
  {
    setTimeout ('document.history.go(0)', 60000);
  }
</script>

That will force it to refresh every minute.

I'm not sure what you want to update the html page with, but say you have a script that allows single log entries into STDIN and uses them to update the html page. You can then easily use a command like:

tail -f /usr/local/apache/logs/error_log > myscript

Which should accomplish what you want it to.

Tom.
0
 
LVL 1

Expert Comment

by:greebo
ID: 2622889
To refresh an HTML page it's easier to use a meta-tag like this :
<Meta Http-equiv="Refresh" Content="30">
This will refresh every 30 seconds.
0
 

Author Comment

by:mragg
ID: 2625118
The part that I really needed to know was if the web page could do the tail - like if there was a java script that could tail the file.  I dont want to have a script that is constantly running. It is for a logfile.

The javascript portion was also what I wanted to know so I will award binkzz if no one else answer soon
0
 
LVL 4

Accepted Solution

by:
binkzz earned 300 total points
ID: 2627131
You can't have javascript tail log files because for security reasons javascript can access neither serverside or clientside filesystems. The best you can really do is to tail straight into an html file that starts with:

<html>
<body>
<pre>

And after that you do the `tail -f logfile >> htmlfile`.

I think that's the closest you can get to your solution without resulting to java applett solutions.

Tom
0
 

Author Comment

by:mragg
ID: 2629448
I thought so, but just checking.

Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question