1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Logging of MySQL Queries and Forwarding to Syslog/Event log

Discussion in 'MySQL' started by Sudharsh Ram, Oct 24, 2018.

  1. #1
    I was to able to enable Error log, General Query log, Slow Query Log and Binary Log and was able to forward the logs to Syslog. I have few questions about logging.

    1) The error log is automatically forwarded to Event log in Windows. How do I forward the other logs to event log as well?

    2) Is it possible to convert the multiline mysql logs to single line?

    3) Is it possible to add some header to the log files or some tag at the beginning of each log line?

    4) In the slow query logs, some information is commented. When forwarded using syslog, these lines are not forwarded. How to forward these lines also?
        # User@Host: debian-sys-maint[debian-sys-maint] @ localhost []
        # Query_time: 0.000297  Lock_time: 0.000220 Rows_sent: 0  Rows_examined: 0
        SET timestamp=1539924163;
        select count(*) into @discard from `information_schema`.`EVENTS`;
    Code (markup):
    5) mysqlbinlog can be used to convert the binary log to human readable format. Is there a way where I can convert the binary file and forward it to syslog without writing any custom script? Is there a way in mysql or rsyslog?
     
    Sudharsh Ram, Oct 24, 2018 IP