2

I'm trying to set my general log file to a fifo named pipe and am getting an error

$ sudo mkfifo -m 0666 general.fifo

mysql> set global general_log_file='/var/log/mysql/dradis/general.fifo';
ERROR 1231 (42000): Variable 'general_log_file' can't be set to the value of '/var/log/mysql/dradis/general.fifo'

mysql> \! ls -l /var/log/mysql/dradis/general.fifo
prw-rw-rw- 1 root root 0 Nov 27 14:27 /var/log/mysql/dradis/general.fifo

Version I'm running 5.6.20-68.0-log Percona Server.

How can I make this work?

atxdba
  • 5,273
  • 5
  • 40
  • 60

1 Answers1

1

It looks like it should work because the general_log_file is dynamic (according to the MySQL Documentation).

Some six(6) years ago, Joel Hanger answered How do I output MySQL logs to syslog?. In his answer, he added it to the my.cnf. Evidently, a mysqld restart would be needed.

In your particular case, you may have to enable the general log first using

SET GLOBAL general_log = 1;

to initiate a general log with the default name of hostname.log.

This will create an open file handle. You may then have to try setting the general_log_file with general_log on and off. You may also have to run FLUSH LOGS; to force the closing and reopening of log file handles.

This answer is just a lazy guess, so try it and see.

RolandoMySQLDBA
  • 182,700
  • 33
  • 317
  • 520
  • If I try enabling general_log=1 first it still results in the same error.

    In a test instance I was able to get it working with the cnf and restart. Unfortunately I'm currently wanting this on a mysqld I can't restart at the moment :(

    – atxdba Nov 27 '17 at 20:52
  • Set general_log back to 0. This will close the file. Then, try again. Does it still produce the same error ??? – RolandoMySQLDBA Nov 27 '17 at 20:54
  • Same error. Seems like restart is required if you want to use fifo :( – atxdba Nov 27 '17 at 20:55
  • OK we tried. Make sure you go upvote https://dba.stackexchange.com/questions/3552/how-do-i-output-mysql-logs-to-syslog/5106#5106. – RolandoMySQLDBA Nov 27 '17 at 20:56
  • 1
    What is good here is that your question exposes the fact that configuring a FIFO pipe will not work dynamically. – RolandoMySQLDBA Nov 27 '17 at 20:58
  • One more suggestion: try using fifo (https://linux.die.net/man/7/fifo) instead of mkfifo since the file becomes part of the file system. – RolandoMySQLDBA Nov 27 '17 at 21:09