Logging with syslog-ng into MySQL

Posted on 2008-11-19
Last Modified: 2012-05-05
I"m attempting to configure my first syslog-ng as well as piping all the messages to a MySQL database and viewing those entries via php-syslog-ng.  PHP-syslog-ng is working and connecting to the database.  I"ve "borrowed" example syslog-ng.conf files from all over the internet but I just can't seem to get anything to pipe into the MySQL database.  I am, for some reason, creating daily tables but nothing appears in those tables.  I believe syslog message are being sent to my server as I have a router sending logging message to the server and it states that nearly 3000 messages have been sent to the syslog server.  I'm attaching our syslog-ng.conf as well as the pipe file for your review.  Any assistance with this is greatly appreciated.  
Question by:custominet
    LVL 14

    Expert Comment

    Is your pipe being written at all? (you can just do a 'cat <filename>')


    Author Comment

    There is a /var/log/mysql.pipe but when I did ca /var/log/mysql.pipe, it just sat there at a blank line until I did CTRL-C to stop it.  Also the time stamp is last night at 11:30
    LVL 14

    Expert Comment

    So you need to get data into the pipe, that is the first thing to solve.

    Which distro are you running?

    In RHEL 5 (or simular) and Ubuntu all you need to do to write to a named pipe from syslog is:

         # Sample configuration to route kernel debugging
                       # messages ONLY to /usr/adm/debug which is a
                       # named pipe.
                      kern.=debug              |/usr/adm/debug


    Author Comment

    I'm running Debian Etch.  Is the above supposed to go into the syslog-ng.conf?  If not, where does it go?

    Author Comment

    Here's what I"m getting (or not getting seems to be more appropriate)...

    mysql> show tables;
    | Tables_in_syslog |
    | actions          |
    | all_logs         |
    | cemdb            |
    | logs             |
    | logs20081119     |
    | logs20081120     |
    | logs20081121     |
    | logs20081122     |
    | logs20081123     |
    | logs20081124     |
    | search_cache     |
    | user_access      |
    | users            |
    13 rows in set (0.00 sec)

    mysql> select * from logs20081124;
    Empty set (0.00 sec)


    I"m not sure as to why the different tables are being inserted as well as why nothing is in any tables???
    LVL 14

    Accepted Solution

    You need to focus on the pipe for now, mysql is step 2.

    You need to get data into the pipe, that isn't happening.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now