:man source: User Commands
:man manual: Logdo Manual

LOGDO(1)
========

NAME
----

logdo - watch logfiles and execute commands with selective log output


SYNOPSIS
--------

*logdo* {[-w 'wait'] [-n 'nlines'] [-s 'script'] [-v 'vregex'] 'regex' 'filename'}..

*logdo* {[-w 'wait'] [-n 'nlines'] [-s 'script'] [-v 'vregex'] 'regex' 'filename'}.. -C 'config' [-q]

*logdo* ['OPTIONS'] -c 'config'


DESCRIPTION
-----------

logdo(1) watches the logfile 'filename' and executes the command
'script' which inputs the pipe from log output lines matching with the
regular expression 'regex' every 'wait' seconds.

The several sets of normal 'OPTIONS', the arguments 'regex' and
'filename' are concurrently managed.


OPTIONS
-------

-w 'wait'::
  Set the delay between executions of the command to <wait> seconds.
  The default value is 1 second.

-n 'nlines'::
  Set the number of past lines to be process. The default value is 0.

-s 'script'::
  Set the command which inputs the pipe from added log. For example,
  setting `cat` as <script> prints added log to standard output.

-v 'vregex'::
  Set the regular expression 'vregex' with matching lines not to be
  process in log outputs.


ADDITIONAL OPTIONS
------------------

-C 'config'::
  Set the <config> file which saves the sets of options, arguments
  'regex' and 'filename'.

-q::
  Quit in parsing options. Use it if you want to save 'config' file
  which is generated from options and arguments without watching
  logfiles.

-c 'config'::
  Set the <config> file which is saved the sets of 'wait', 'script',
  'vregex', 'regex' and 'filename', which are concurrently executed.


ARGUMENTS
---------

'regex'::
  Set the regular expression 'regex' with matching lines to be
  process in log outputs.

'filename'::
  Set the logfile 'filename'.


EXIT STATUS
-----------

'logdo' exits 0 on success, and !0 if an error occurs.


EXAMPLES
--------

If you watch +/var/log/secure.log+ matching \' sshd' lines every 30
minutes, typing the following command line mails such lines to
+foo@example.com+ by the \'mailx' utility.

................................................................................
$ logdo -w 1800 -s 'mailx foo@example.com' ' sshd' /var/log/secure.log
................................................................................

Additionally if you watch +/var/log/git-daemon.log+ matching
\'Connection from \' and not matching \'(127\.0\.0\.1|192\.168\.)'
lines every 24 hours, typing the following command line mails such
lines to +foo@example.com+ likewise.

................................................................................
$ logdo -w 1800 -s 'mailx foo@example.com' ' sshd' /var/log/secure.log \
-w 86400 -s 'mailx foo@example.com' -v '(127\.0\.0\.1|192\.168\.)' 'Connection from ' /var/log/git-daemon.log
................................................................................

As mentioned above you may specify the several sets of a logfile to be
watch and its characteristics, but it is too long to type in a line.

Now you may save the sets of such a command line to +logdo.xml+ with
\'-C 'logdo.xml' -q' without watching logfiles as follows:

................................................................................
$ logdo -w 1800 -s 'mailx foo@example.com' ' sshd' /var/log/secure.log \
-w 86400 -s 'mailx foo@example.com' -v '(127\.0\.0\.1|192\.168\.)' 'Connection from ' /var/log/git-daemon.log \
-C logdo.xml -q
................................................................................

Then you may specify the equal sets with such a command line by
\'-c 'logdo.xml'' option as follows:

................................................................................
$ logdo -c logdo.xml
................................................................................


AUTHOR
------

* Taiji Yamada <taiji@aihara.co.jp>


COPYING
-------

Copyright \(C) 2009 Taiji Yamada. Free use of this software is granted
under the terms of the GNU General Public License version 3 (GPLv3) or
(at your option) any later version.
