• MySQL general logs to syslog

    From rana chand@21:1/5 to All on Mon Oct 19 00:21:42 2020
    Hi All,

    Currently all MySQL error logs and general logs are stored in /var/log/mysql/error.log and /var/log/mysql/mysql.log

    I want to redirect these logs to syslog. So, I have addes the following to the configuration file of mysql:

    [mysqld]
    log-syslog = on

    Now only MySQL error logs are only redirected to the syslog.
    Is there a way to redirect both the error and general logs to syslog.

    Regards,
    Rana

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From J.O. Aho@21:1/5 to rana chand on Mon Oct 19 11:08:19 2020
    On 19/10/2020 09.21, rana chand wrote:
    Hi All,

    Currently all MySQL error logs and general logs are stored in /var/log/mysql/error.log and /var/log/mysql/mysql.log

    I want to redirect these logs to syslog. So, I have addes the following to the configuration file of mysql:

    [mysqld]
    log-syslog = on

    Now only MySQL error logs are only redirected to the syslog.
    Is there a way to redirect both the error and general logs to syslog.

    I haven't really been trying to move the logging of, but it seems that
    people have created a fifo pipe, log to it and then configure the syslog
    to read that fifo pipe as a source.

    https://dba.stackexchange.com/questions/3552/how-do-i-output-mysql-logs-to-syslog

    As far as I can see, mysql supports only error log written to syslog
    with the configuration options the daemon supplies.

    --

    //Aho

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Axel Schwenke@21:1/5 to rana chand on Mon Oct 19 11:53:52 2020
    On 19.10.2020 09:21, rana chand wrote:

    Currently all MySQL error logs and general logs are stored in
    /var/log/mysql/error.log and /var/log/mysql/mysql.log

    I want to redirect these logs to syslog.
    Now only MySQL error logs are only redirected to the syslog.
    Is there a way to redirect both the error and general logs to syslog.

    Not for the general log. You can have that written to a log file or to a database table (typically using the CSV storage engine). IMNSHO the only sensible option here is to write the general log to a file.

    The reasons is this: the general log tends to create tremendous amounts of data. It logs not only each SQL statement, but also connect and disconnect. That means that you need the most efficient way of storing this data - which
    is a file. Syslog is not designed to handle that amount of data. Or that
    rate of incoming messages. Even a log file you will want to rotate rather
    often (easily done by renaming the file and doing FLUSH LOGS). I now read
    that log tables can be rotated with RENAME TABLE. Good. It's still only the second best solution.

    Keep also in mind that the general log is nothing that you should enable light-heartedly. Not on a production system anyway. It makes most sense as a debugging aid.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to rana chand on Mon Oct 19 18:49:59 2020
    On Mon, 19 Oct 2020 00:21:42 -0700, rana chand wrote:

    Hi All,

    Currently all MySQL error logs and general logs are stored in /var/log/mysql/error.log and /var/log/mysql/mysql.log

    I want to redirect these logs to syslog. So, I have addes the following
    to the configuration file of mysql:

    [mysqld]
    log-syslog = on

    Now only MySQL error logs are only redirected to the syslog.
    Is there a way to redirect both the error and general logs to syslog.

    Apparently, not from within mysqld. According to
    https://dev.mysql.com/doc/refman/5.7/en/query-log.html
    the "General Query Log" can only be directed to a file or a mysql table
    (or both a file and a table), or not output at all.

    From the syslog side, syslogd /can/ read from a UNIX-domain socket (if configured to do so), so you /might/ be able to direct the general query-
    log to a "file", with that file being a UNIX-domain socket input known to syslogd.

    I don't know if this will work; I've never tried it.

    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)