Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Syslog and MySQL


    wanted to know if anyone here has experience with logging to a MySQL Database. I want the syslog daemon to sent it's output to a MySQL database instead of /var/log/messages.

    - which software to use (I don't think the syslog daemon can do this default)
    - how about performance

    kind regards,


  2. #2
    Linux Guru
    Join Date
    Apr 2003
    London, UK
    Performance will decrease, and then what happens if mysqld fails?

    If you REALLY want to get syslog entries into mysql the best way todo it would be to write a script to parse the /var/log/messages file on an hourly basis and run INSERT queries for each of the entries, then clear the log file contents again.

    EDIT: Alternativly write your own syslogd to listen for input on /dev/log and then write that to a mysqldb directly, or modify an existing syslogd code to do this.


  3. #3
    Just Joined!
    Join Date
    Jun 2004
    I use sqlsyslogd ( to insert log messages in a MySQL database. There's also a PERL version in

    Basically it works like this:

    • - Create a FIFO somewhere on your file system (mkfifo).
      - Configure syslog to write the messages you want to that FIFO
      - Run a script that keeps reading the FIFO and every time something shows up, call sqlsyslogd to store it in MySQL

    I have this setup in a central log server, receiving logs from about 10 machines. It seems to never miss any messages. There are no problems with performance, just with storage space. You really want to filter the kind of messages that go into MySQL, or your tables will grow very fast.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts