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