Spotlight | Reviews | Current Issue | Academy | Newsletter | Subscribe | Shop |
Departments

Partner Links
Make your own website
WinWeb OnlineOffice
Comparing prices of hardware is worth it.
Price Comparison
UK Linux Jobs
What:
Where:
Country:
vacatures Netherlands njobs Linux vacatures
arbeit Deutschland njobs Linux arbeit
work United Kingdom njobs Linux jobs
Lavoro Italia njobs Linux lavoro
Emploi France njobs Linux emploi
trabajo Espana njobs Linux trabajo

user friendly

Admin Magazine

ADMIN Network & Security

Subscribe now and save!

ADMIN - Explore the new world of system administration! Special introductory offer! Order by September 30th to save 10% off the regular subscription price! Each issue delivers technical solutions to the real-world problems you face every day. Learn the latest techniques for better:

  • network security
  • system management
  • troubleshooting
  • performance tuning
  • virtualization
  • cloud computing

 

on Windows, Linux, Solaris, and popular varieties of Unix.

http://www.admin-magazine.com/

  linux-magazine.com » Issues » 2008 » 91 » Charly's Column  

Print this page. Recommend
Share

The sys admin's daily grind: RSyslog

Where To Next?

Well-used services write reams of log information to disk, which is not only bothersome from a storage perspective but also pushes grep and the usual group of statistics tools to their limits. Will hitching the syslog daemon up to a database help?

Who said length doesn't matter? My spam filters alone give me a 3GB logfile daily, which would be fine if I just needed the beast to check up on the occasional error. Because I need to extract a whole bunch of statistics about spam and virus threats from the file, grepping such enormous files takes ages, besides creating far too much I/O overhead.

RSyslog [1] took me a giant leap closer to finding a solution – it logs directly to a MySQL or PostgreSQL database, meaning that I can replace my grep commands with fast SQL statements. RSyslog is included with many distributions and is the default application in Fedora 8, for example. By default, my Ubuntu lab environment runs sysklogd, making it easy for me to switch to RSyslog. For the time being, I can even keep my old syslog.conf. For the most part, RSyslog's configuration file is the same as the legacy format, although it does support a couple of additional options for linking up with the database.

First I need to set up a database. To do so, I run the createDB.sql script, which is provided with the RSyslog package:

mysql -u root -pPasswort < ./createDB.sql

This command line automatically creates a database called Syslog along with the required tables.

At the MySQL prompt, I then create a user and assign privileges:

> grant ALL ON Syslog.* to rsyslog@localhost
 identified by 'secret';
> flush privileges;

Next, telling RSyslog to use the database is refreshingly simple – just two lines in /etc/rsyslog.d/mysql.conf:

$ModLoad MySQL
mail.* >localhost,Syslog,rsyslog,secret

The first line loads the module that RSyslog needs to access the database. The second line defines the log facility containing the entries RSyslog will push to the database. The mail facility data are all I need to create spam filter statistics, followed by the access parameters for the MySQL database: hostname, database name, MySQL user name, and password.

After rebooting, I was pleased to see the RSyslog daemons filling the database (Figure 1). All done! This won't magically improve your spam statistics, but at least it will get the job done faster. Incidentally, the example here works with the current 2.0.2. stable release. RSyslog's author, Rainer Gerhards, is working hard on a 3x version, which he promises will add even more neat features.


Figure 1: RSyslog feeds log information to a database instead of a file. The database provides the back end for statistics, such as the spam information shown here.


Figure 2: If your system doesn't come with rsyslog, you can download the latest version

Infos

  1. RSyslog: http://www.rsyslog.com

The Author

Charly Kühnast is a Unix System Manager at the data center in Moers, near Germany's famous River Rhine. His tasks include ensuring firewall security and availability and taking care of the DMZ (demilitarized zone).


Read full article as PDF »


Comments


Print this page. Recommend
Share
Related Articles
Open Source Job Scheduler Open Source Job Scheduler
Workspace: Business Data Business intelligence with OpenOffice.org Base
Hyperic HQ Application performance monitoring with Hyperic HQ
KDE COOKING Create a KDE-based recipe database
Herding IP Cats The sys admin’s daily grind: GestióIP
When Geeks Cruise Linux Lunacy, Perl Whirl,MySQL Swell: Open Source technologists on board
Get your backstage pass to Linux!

If you're ready for a deeper look, Linux Magazine gives you a view behind the scenes.

Don't miss out on the tools, tutorials, and reviews you'll need to unlock the secrets of Linux.

more...