O log de consultas do MySQL está vazio após a inicialização

1

Não consigo descobrir porque o log de consultas geral e lenta está vazio após a reinicialização do computador. Depois de reiniciar o servidor com systemctl, os logs são preenchidos. Após a reinicialização, os arquivos são criados apenas vazios.

$ stat /var/log/mysql/query.log
  File: '/var/log/mysql/query.log'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d      Inode: 6947352     Links: 1
Access: (0660/-rw-rw----)  Uid: (   89/   mysql)   Gid: (   89/   mysql)
Access: 2016-04-28 05:04:04.530835820 +0200
Modify: 2016-04-28 05:04:04.530835820 +0200
Change: 2016-04-28 05:04:04.530835820 +0200
 Birth: -
$ stat /var/log/mysql/slow.log
  File: '/var/log/mysql/slow.log'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d      Inode: 6947484     Links: 1
Access: (0660/-rw-rw----)  Uid: (   89/   mysql)   Gid: (   89/   mysql)
Access: 2016-04-28 05:04:04.530835820 +0200
Modify: 2016-04-28 05:04:04.530835820 +0200
Change: 2016-04-28 05:04:04.530835820 +0200
 Birth: -

my.cnf:

# The MariaDB server
[mysqld]
port    = 3306
socket = /run/mysqld/mysqld.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server = utf8

general_log = 1 # log every query
general_log_file = /var/log/mysql/query.log

slow_query_log = 1
long_query_time = 1

Arquivo de unidade do Systemd:

$ cat /etc/systemd/system/multi-user.target.wants/mysqld.service
[Unit]
Description=MariaDB database server
After=syslog.target

[Service]
User=mysql
Group=mysql

ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid 
ExecStartPost=/usr/bin/mysqld-post

Restart=always
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Após o serviço reiniciar, os logs são preenchidos:

$ sudo systemctl restart mysqld.service 
$ stat /var/log/mysql/query.log
  File: '/var/log/mysql/query.log'
  Size: 255             Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 6947352     Links: 1
Access: (0660/-rw-rw----)  Uid: (   89/   mysql)   Gid: (   89/   mysql)
Access: 2016-04-28 05:04:04.530835820 +0200
Modify: 2016-04-28 06:50:52.534122763 +0200
Change: 2016-04-28 06:50:52.534122763 +0200
 Birth: -
$ stat /var/log/mysql/slow.log
  File: '/var/log/mysql/slow.log'
  Size: 171             Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 6947484     Links: 1
Access: (0660/-rw-rw----)  Uid: (   89/   mysql)   Gid: (   89/   mysql)
Access: 2016-04-28 05:04:04.530835820 +0200
Modify: 2016-04-28 06:50:51.854122769 +0200
Change: 2016-04-28 06:50:51.854122769 +0200
 Birth: -
    
por michalzuber 28.04.2016 / 08:41

0 respostas