[Gllug] Intelligent, multiple, log tails

Marcus Taylor marcus at fatbeehive.com
Wed Jan 7 13:45:17 UTC 2009


After a cup of tea this is better

ls -bt|xargs tail -n 10

The b switch on ls adds escape characters on the output so xargs doesn't
bork on spaces. 

The t switch orders by last modified



Out of habit I use the a switch aswell to show hidden files but most logs are
not hidden.

On Wed, 7 Jan 2009 13:26:01 +0000
Marcus Taylor <marcus at fatbeehive.com> wrote:

> I like xargs :) http://unixhelp.ed.ac.uk/CGI/man-cgi?xargs
> 
>  ls -at |xargs tail -10 |more
> 
>  
> 
> 
> 
> 
> On Wed, 07 Jan 2009 13:06:41 +0000
> David L Neil Mailing list a/c <GLLUG at getaroundtoit.co.uk> wrote:
> 
> > Bit of a newbie question: Does someone have a quick way to view (only)
> > recent updates to ANY and ALL server logs please?
> > 
> > 
> > I have a dev server and have directed all logs into one directory
> > (including Apache (multiple VHost, CMS, plus rewrite), multiple DB
> > servers, multiple email servers, PHP (etc), and applications' own logs).
> > 
> > When I'm tinkering, my habitual checking for any logged error/access/etc
> > involves first jumping into the File Browser to see which logs have new
> > entries, and then tail-ing each file, as relevant.
> > 
> > So to save time I have scripted the `tail` but that only amounts to a
> > few keystrokes because it is the log fileNM which is the longer (and
> > often with awkward dashes and underscores). Similarly I can script an
> > `ls` to list recently-changed files first. However I'm not smart
> > enough/BASH-experienced enough to put these together intelligently -
> > even assuming that is the way to go... Not sure what it might be called,
> > but does someone already have such a utility please?
> > 
> > 
> > - inspect nominated directory (default stated)
> > - check for files changed in last n-minutes (say, 10 mins)
> > or ...changed since hh:mm time
> > - list the log fileNM and its last 10 (say) entries foreach
> > - no need to state particular log fileNMs as parameters
> > 
> > or
> > - right-click on fileNM in Gnome File Browser
> > - select 'tail' from context menu for a magical pop-up
> > 
> > or ???something someone has undoubtedly set-up long ago
> > 
> > 
> > I know CentOS has a system log viewer but I haven't got into it beyond
> > its default settings for simple SysAdmin monitoring. I have rejected
> > db-based ideas because sometimes (shock, horror) my 'change' might foul
> > up the RDBMS... Perhaps I should be using the Apache "combined" log
> > format option to reduce the sheer number of logs? All advice, best
> > practice wisdom, etc, will be appreciated.
> > 
> > Please advise,
> > =dn
> > CentOS 5.2, Gnome 2.16, Apache 2.2, PHP 5.2, Python 2.4, ...
> 
> 


-- 
+----------------------------------------------------------------------+
|     Marcus Taylor     |                            Tel: 0207 7398704 |
+-----------------------+                 Email: marcus at fatbeehive.com | 
| Systems Administrator |               Web: http://www.fatbeehive.com |
|    Fat Beehive Ltd    | 2nd Floor, 59 Rivington St, London, EC2a 3QQ |
+-----------------------+----------------------------------------------+
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list