Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to monitor the log file of my application which however doesn't work locally but on a SaaS platform and is exposed over HTTP and WebDAV. So, an equivalent of tail -f that works for URLs would do great job for me.

P.S. If you know of any other tools that can monitor remote files over HTTP, it may also be of help. Thanks

share|improve this question
1  
Is it shown as plain text on the remote server or as html? –  terdon Dec 3 '12 at 12:46
    
Plain text with specific format: [timestamp] Error_name ..... Which I then intent to filter through grep –  munch Dec 3 '12 at 12:54
    
You can use wget -N http://somewhere/something, that'll download file only if it's newer than one that you downloaded before or use wget -O - http://somewhere/something to redirect file to stdout. –  week Dec 3 '12 at 13:08

1 Answer 1

up vote 2 down vote accepted

There may be a specific tool for this, but you can also do it using wget. Open a terminal and run this command:

while(1); do \
    sleep 2; \
    wget -ca -O log.txt -o /dev/null http://yoursite.com/log; \
done

This will download the logfile every two seconds and save it into log.txt appending the output to what is already there (-c means continue downloading and -a means append the output to the file name given). The -o redirects error messages to /dev/null/.

So, now you have a local copy of log.txt and can run tail -f on it:

tail -f log.txt 
share|improve this answer
    
I found out that I could use davfs2 to integrate with the webDAV interface and then use the file like a regular file. This is what I really expected. But your solution is more simple and actually works –  munch Dec 3 '12 at 16:05
    
I found that everything is being saved in "log" file not "log.txt". In my case this works: wget -ca -O log.txt -o /dev/null yoursite.com/log –  yatsa Feb 18 at 10:49
    
@yatsa yes, you're right, fixed now, thanks. –  terdon Feb 18 at 13:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.