Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5662

Slow Query / General Log / Error log rotation

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: 10.1
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      there is no buit-in rotation for these logs in MariaDB. As this can be easily scripted in Unix systems, this is another story for Windows.

      Wouldn't it be easy to implement rotation, the same way as the audit plugin does?

      Joffrey

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment - - edited

            I'd say "rewrite slow/general/error logs to use the logger service".
            Obvious issues:

            • error log often goes to stderr, this cannot use the logger
            • logs can be sent to a table. It would be great if the logger would support it, but realistically we'll probably only use the logger for files.

            A thought:

            • with more and more logger instances (more than one, in fact) we may want to have consistent names for command-line options/server variables for all logs, instead of doing them ad hoc per log in plugins or in the server. Something like: every log automatically creates --log-<logname>-* set of options/variables. This means logs have to be declared statically, not created dynamically.
            Show
            serg Sergei Golubchik added a comment - - edited I'd say "rewrite slow/general/error logs to use the logger service". Obvious issues: error log often goes to stderr, this cannot use the logger logs can be sent to a table. It would be great if the logger would support it, but realistically we'll probably only use the logger for files. A thought: with more and more logger instances (more than one, in fact) we may want to have consistent names for command-line options/server variables for all logs, instead of doing them ad hoc per log in plugins or in the server. Something like: every log automatically creates --log-<logname>-* set of options/variables. This means logs have to be declared statically, not created dynamically.
            Hide
            Meerkat63 Peter McLarty added a comment -

            I have setup log rotation using the new unix_socket plugin to authenticate without password. This solves getting logrotate to work. I have had it running for a month without issues on a Redhat server

            Show
            Meerkat63 Peter McLarty added a comment - I have setup log rotation using the new unix_socket plugin to authenticate without password. This solves getting logrotate to work. I have had it running for a month without issues on a Redhat server
            Hide
            serg Sergei Golubchik added a comment -

            Yes, that's a very good idea!
            We'll be doing the same for our debian packages too (debian used to create a special maintenance mariadb user with a password stored somewhere in /etc, unix_socket is a much better solution).

            Show
            serg Sergei Golubchik added a comment - Yes, that's a very good idea! We'll be doing the same for our debian packages too (debian used to create a special maintenance mariadb user with a password stored somewhere in /etc, unix_socket is a much better solution).
            Hide
            danblack Daniel Black added a comment -

            Note the SQL_ERROR_LOG already does its own size based rotation.

            This means logs have to be declared statically, not created dynamically.

            Er yuck!

            unix_socket is a much better solution

            Having the patch in MDEV-7781 merged would make packaging significantly easier.

            The other issue with logrotation on RHEL machines is the selinux permission on the datadir can't also be labeled to make logrotate to hande

            Another way is to at least normalize the internally logging so its compatible with a systemd journal API http://www.freedesktop.org/wiki/Software/systemd/catalog/

            Show
            danblack Daniel Black added a comment - Note the SQL_ERROR_LOG already does its own size based rotation. This means logs have to be declared statically, not created dynamically. Er yuck! unix_socket is a much better solution Having the patch in MDEV-7781 merged would make packaging significantly easier. The other issue with logrotation on RHEL machines is the selinux permission on the datadir can't also be labeled to make logrotate to hande Another way is to at least normalize the internally logging so its compatible with a systemd journal API http://www.freedesktop.org/wiki/Software/systemd/catalog/
            Hide
            serg Sergei Golubchik added a comment -

            Yes, of course. When we'll have an internal logging API used consistently for all logs, it would be easy to extend it to log to systemd journal or to syslog or anywhere else.

            Show
            serg Sergei Golubchik added a comment - Yes, of course. When we'll have an internal logging API used consistently for all logs, it would be easy to extend it to log to systemd journal or to syslog or anywhere else.

              People

              • Assignee:
                Unassigned
                Reporter:
                joffrey Joffrey MICHAIE
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: