| About | Screenshots | Readme | Manpage | FAQ | Download | Mail. List |
Here you can find the complete documentation about installing and using logsend.
Since logsend is written in bash, you will need a decent version of it. The oldest bash version used for testing was 2.05a.0.
Dialog is required only if you want to use the configuration interface. You are strongly advised to use it and install a decent dialog version; the oldest dialog version used for testing was 0.9a-20020309a.
Mail Transport Agent: it can be postfix, qmail, sendmail or other. Probably there is one installed already. If not, get postfix, seems to be the easiest to install.
The mail command is usually provided by the mailx package.
Since tail is part of coreutils it is likely that you have it; but check its version. Old versions of tail make no difference between stdout and stderr. The oldest version used for testing was 5.2.1.
You probably already have it. Type: "awk" and you should see the usage.
You will need it only if you want to use the INOTIFY backend. You can get it from here: http://inotify-tools.sourceforge.net.
For installing into the default location (/usr/local), or other locations for which a regular user doesn't have write permission, you have to log in as 'root' first. After getting the archive from http://logsend.sourceforge.net, extract it and install logsend:
tar xzf logsend-x.y.tar.gz cd logsend-x.y.tar.gz make install
This will install logsend into /usr/local. If you want to use another location, specify it using the ${prefix} variable, for example:
prefix=/opt make install
will install it into /opt/logsend-x.y/
If you don't have "make" installed or preffer not to use it, you can call the "install.sh" script directly:
./install.sh -i
Or, for using other location than /usr/local:
prefix=/opt ./install.sh -i
You may want to keep this extracted archive on your filesystem; if you change your mind later and want to uninstall logsend, you will be able to do it this way:
prefix=/opt make uninstallOr:
prefix=/opt ./install.sh -u
Always remember that each user can run his / her own instance of logsend, so you should configure it as the same user you plan to use it. Also, this user needs read permission on the files to watch; and this is something a regular user usually doesn't have when it comes about the system's log files.
The recommended method of configuration is using the dialog based interface, since it will get you starting quick and easy. However, if you preffer not to use it, skip to the "Manual configuration" section. A major benefit of the interface is that if you happen to make a mistake while configuring (typo or other), you will be prompted and can immediately fix it. If you make a mistake during the manual configuration, however, you will be warned when you will try to start logsend.
Fire up the interface:
logsend config
Now go to the first item ("Basic configuration") and set the files to watch and your e-mail address.
These are the most important settings: logsend will need to know what files you need it to supervise, and also what is your e-mail address, so that it will be able to send you the notifications. Add the files to the list, one by one, and type their full path. Take your time, once you will be done there won't be many other things left to do.
Also make sure you enter your precise e-mail address, the interface will only check its format, but there won't be any way of knowing about your typos.
Since you finished setting the above, you should send a test e-mail to make sure you will receive the forthcoming notifications sent by Logsend. Do it now: go to the main menu, item 4. If you received it, you're done: exit and save the settings (and skip to the "Starting logsend" section). But if you didn't, there are some things you may want to check:
In this section are described some things you can do to tweak logsend's behaviour. If you're in a hurry, you can skip it and go to "Starting logsend".
While watching a file for changes, you may not be interested in all the lines added to the file, but only in the lines that contain a certain word (or string). For example, you need to watch the /var/log/auth.log file to know who and when logs in, but you are interested only in the remote logins, via ssh; in this case the string to search for is 'ssh', and an e-mail will be sent when lines containing 'ssh' will be added to auth.log.
Sometimes, if changes occur too often to a file, you will be bombed with e-mails. Setting a minimum delay between the e-mails to be sent will prevent this from happening. If you don't specify a delay, the default will be used, which is 10 minutes. The time format for the delay is the one used by 'sleep' (50s = 50 seconds; 20m = 20 minutes; 5h = 5 hours; 1d = 1 day). Check the sleep man page for more details.
Logsend can use different backends to detect the changes to the files. With the TAIL backend it detects changes using the 'tail' command and analysing its output. It doesn't need any particular kernel version or packages to be installed, so you can always switch to TAIL if you are using an older system or a non-linux kernel. Also, this is recommended for high-activity servers. If you are a home user and you have a recent kernel, you might want to use the INOTIFY backend which saves logsend from the trouble of making checks even if the files to watch didn't change. The SIMPLE backend will check the files periodically to detect line additions, and the time period between two consecutive checks is the e-mail delay. Don't use it on rotated files.
Inotify is a Linux kernel subsystem that provides file system event notification. See http://en.wikipedia.org/wiki/Inotify for more details.
Chances are that it is built into your kernel and running if the kernel version is >= 2.6.13. To find out if it is compiled into the kernel, do these:
zgrep INOTIFY /proc/config.gz
or:
grep INOTIFY /boot/your-kernel-config-file.
or, on Gentoo systems:
grep INOTIFY /etc/kernels/your-kernel-config-file
You should see 'CONFIG_INOTIFY=y'
If /proc/sys/fs/inotify exists, inotify is enabled. In older versions it used a device node, /dev/inotify or /dev/misc/inotify, so you may want to check for that too.
Logsend uses the 'inotifywait' command, provided by 'inotify-tools', so please install 'inotify-tools'. You can get it from here: http://inotify-tools.sourceforge.net.
Having different themes available proves to be useful while using the live monitor; if you want to keep an eye continuously on several files, you can have multiple instances of the live monitor up and running in different terminals / tabs, each one having its own colour.
Ok, so you chose not to use the dialog interface. First you should know that longsed stores its configuration file into your home directory, under
.logsend/${USER}-conf/logsend.conf If this is the first time you run logsend, you should create this directory:
mkdir --parents ~/.logsend/${USER}-conf/
Copy the default configuration file which is located under /usr/local/share/logsend-1.0/logsend.conf.default (if you installed into the default location), to the directory you created and rename it to 'logsend.conf':
cp /usr/local/share/logsend-1.0/logsend.conf.default \
~/.logsend/${USER}-conf/logsend.conf
Now fire up your preffered text editor and change these variables in 'logsend.conf': 'LH_MAIL_ADDRESS', 'LH_FILES'. The file is heavily commented so it shouldn't be hard to figure out what to do. Optional, you can change these too: 'LH_BACKEND', 'LH_MAIL_DELAYS', 'LH_GREP_STRINGS' (or anything else you want).
Once you're finished with the configuration, it's time to start logsend. Just type:
logsend start
There are also other actions beside 'start', like 'stop', 'restart' and 'status'. Use them to control it.
Starting at boot time is possible if you configured logsend as the root user. Logsend doesn't come with an init script, since it behaves like an init script itself. You should link it to the proper runlevel. Eg.:
* on Gentoo:
echo "/usr/local/bin/logsend start" >> /etc/conf.d/local.start rc-update add local default
This will start logsend in the default runlevel.
* on Debian:
echo "/usr/local/bin/logsend start" > /etc/init.d/logsend chmod 755 /etc/init.d/logsend ln -s /etc/init.d/logsend /etc/rcS.d/S85logsend
This will start logsend in all the runlevels.
* other systems
echo "/usr/local/bin/logsend start" > /etc/init.d/logsend chmod 755 /etc/init.d/logsend ln -s /etc/init.d/logsend /etc/rc5.d/S85logsend
This will start logsend in runlevel 5 (graphical / X)
It will start no matter if you had a power failure or accidentaly pushed the 'Reset' button; logsend doesn't use lock files to keep track of its status.
Below are some examples you can use to watch certain servers' activity. They are only guidelines, your servers might keep logs to other files than those mentioned. They are written for the case of manual configuration, but if you use the dialog interface, it will be even easier; 'LH_FILES' reffers to the "Files to watch"; 'LH_GREP_STRINGS' reffers to the "Strings to search"; 'LH_MAIL_DELAYS' reffers to the "E-mail delays".
* for watching ssh logs:
* for watching apache-ssl logs:
* for watching mail logs (postfix) :
* for watching ssh logs and su sessions:
* for watching all the authentication activity (logins: xdm, su, ssh, pam, ... )
As logsend calls the grep command having 'LH_GREP_STRINGS' ("Strings to search") as a pattern for search, you can set 'LH_GREP_STRINGS' to anything grep understands. For example:
* if you need to get only the changes related to "ssh" OR "su", no matter where they occur, alone or together on a line, use:
* if you need to get only the changes related to "ssh" AND "su" (when they occur together on the same line), use:
* if you need to also pass some options to grep (which will be used for searching patterns into the new added lines), set them in the 'LH_GREP_EXTRA_OPTS' variable (or, if you use the dialog interface, in the "Extra options for grep" section):
If you don't, 'grep' defaults to '-e'.
Just some examples.
Logsend was designed for monitoring files (and search them) and not entire directories. However, it is possible to watch directories too, but only with the inotify backend, and with these limitations:
While watching a full directory (with the inotify backend), will be sent only the modification events related to the directory and to the files belonging to it, and not the lines added to the files. Also, in this case, receiving notifications for the changes which occured while logsend wasn't running is not possible.
* Note: Since the differences between the logsend versions are often significant, the differences in the documentation tend to be significant too. You should always use the documentation provided with your package.