# Tail f to an element using ajax

**URL:** <https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886>\
**Category:** Rails\
**Created:** [March 14, 2008, 4:19am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886 "2008-03-14T04:19:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dion\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dion\_H](https://www.ruby-forum.com/u/Dion_H)\
**Post date:** [March 14, 2008, 4:19am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886/1 "2008-03-14T04:19:00Z")

</div>

hi all,

do you think it would be possible to tail -f the production log and  
update  
an html element using rjs

so that the web page is updated every time the production log is  
updated?

basically I want to see my logs on an admin web page so I don’t have to  
ssh  
into my server

dion

---

<div class="post-metadata">

**Author:** ![Dion\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dion\_H](https://www.ruby-forum.com/u/Dion_H)\
**Post date:** [March 14, 2008, 6:12am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886/2 "2008-03-14T06:12:43Z")

</div>

Dion H. wrote:

> do you think it would be possible to tail -f the production log and  
> update an html element using rjs
> 
> so that the web page is updated every time the production log is updated?

All you need is periodically\_call\_remote. Get googling!

> basically I want to see my logs on an admin web page so I don’t have to  
> ssh into my server

I would only abuse Ajax for a paying customer. For myself, I would  
simply either  
nab one of several log-reading websites which I suspect are out there,  
or would  
dump the log into a

```
tag and then hit refresh frequently - or
automate the
refresh with a META tag.

Is there some reason you need to watch your logs so often?

–  
Phlip  
[http://assert2.rubyforge.org/](http://assert2.rubyforge.org/)
```

---

<div class="post-metadata">

**Author:** ![Dion\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dion\_H](https://www.ruby-forum.com/u/Dion_H)\
**Post date:** [March 14, 2008, 7:07am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886/3 "2008-03-14T07:07:49Z")

</div>

You could do something like this which I think is more secure… you  
are  
using Capistrano, right?

[http://snippets.dzone.com/posts/show/2484](http://snippets.dzone.com/posts/show/2484)

---

<div class="post-metadata">

**Author:** ![Dion\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dion\_H](https://www.ruby-forum.com/u/Dion_H)\
**Post date:** [March 14, 2008, 7:25am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886/4 "2008-03-14T07:25:24Z")

</div>

thats a neat trick…

but requires you to be on a development machine with capistrano

I want to be able to monitor my logs from any machine, with just the  
browser…

---

<div class="post-metadata">

**Author:** ![Dion\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@Dion\_H](https://www.ruby-forum.com/u/Dion_H)\
**Post date:** [March 14, 2008, 8:32am UTC](https://www.ruby-forum.com/t/tail-f-to-an-element-using-ajax/131886/5 "2008-03-14T08:32:37Z")

</div>

If you want a bit more flashy tailing of your logfiles, you could have a  
look at glTail from [http://www.fudgie.org](http://www.fudgie.org)

We’re running it at work on a big monitor with great success.

– Erlend
