Rsyslog doesn't have write permission to /var/log/mysql/ directory

Bug #1615680 reported by Aleksei Shishkin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
High
Maksim Malchuk
Mitaka
Fix Released
High
Maksim Malchuk

Bug Description

Detailed bug description:
In Mirantis OpenStack 9.0 Rsyslog does not have write permission to /var/log/mysql/ directory. User 'syslog' belongs to 'adm' group, but /var/log/mysql/ directory has only r.x attributes for this group.
Therefore Rsyslog cannot create MySQL log files.
This bug appeared in the process of solving next bug: https://bugs.launchpad.net/fuel/+bug/1550984

Steps to reproduce:
 Check existence of MySQL log file /var/log/mysql/mysqld.log

Expected results:
  MySQL logs should be in log file /var/log/mysql/mysqld.log

Actual result:
  Log file /var/log/mysql/mysqld.log does not exist

Reproducibility:
  Reproduced on several MOS 9 environments

Workaround:
  # chmod 770 /var/log/mysql/

Impact:
  Currently we don’t have any MySQL logs in all deployments (apart from the error.log because it was created at the time of deployment and does not contain any useful info).
  This is critical bug because it makes difficult to analyze MySQL issues.
  This bug also found on customer environment

Description of the environment:
 Operation system: Ubuntu 14.04
 Versions of components: MOS 9.0

Additional information:

----------------------
[root@fuel ~]# cat /etc/fuel_build_id
495
[root@fuel ~]# cat /etc/fuel_release
9.0
[root@fuel ~]# cat /etc/fuel_openstack_version
mitaka-9.0

----------------------
root@node-1:~# id syslog
uid=101(syslog) gid=104(syslog) groups=104(syslog),4(adm)

----------------------
root@node-1:~# ll /var/log/mysql/
total 16
drwxr-x--- 2 mysql adm 4096 Aug 22 11:50 ./
drwxrwxr-x 27 root syslog 4096 Aug 22 10:49 ../
-rw-r----- 1 mysql adm 6758 Aug 20 20:06 error.log

----------------------
root@node-1:~# cat /etc/rsyslog.d/04-mysql.conf
# This file is managed by Puppet, changes may be overwritten
# managed by puppet

### collect mysql* logs of all levels in /var/log/mysqld.log
if ($programname == 'mysql' \
  or $programname == 'mysqld' \
  or $programname == 'mysqld_safe' \
  or $programname == 'mysql_slow' \
  or $programname == 'mysql-wss') \
then -/var/log/mysql/mysqld.log
### stop further processing for the matched entries
& ~

----------------------
Rsyslog debug info:
0835.920442032:7f46461f2700: entering actionCalldoAction(), state: itx
0835.920443874:7f46461f2700: file to log to: /var/log/mysql/mysqld.log
0835.920445619:7f46461f2700: omfile: start of data: '<30>Aug 22 13:00:35 node-1 ocf-mysql-wss: INFO: p_mysqld: check_if_sst(): MySQL process 532597 found'
0835.920447393:7f46461f2700: write to stream, pData->pStrm 0x7f46400149e0, lenBuf 101
0835.920449600:7f46461f2700: action 0x2385880 call returned -2121
0835.920452931:7f46461f2700: strm 0x7f46400149e0: file -1(mysqld.log) flush, buflen 101
0835.920458135:7f46461f2700: strmPhysWrite, stream 0x7f46400149e0, len 101
0835.920467866:7f46461f2700: file '/var/log/mysql/mysqld.log' opened as #-1 with mode 416
0835.920472950:7f46461f2700: strm 0x7f46400149e0: open error 13, file '/var/log/mysql/mysqld.log': Permission denied

tags: added: customer-found
summary: - Rsyslog doesn't has write permission to /var/log/mysql/ directory
+ Rsyslog doesn't have write permission to /var/log/mysql/ directory
tags: added: area-library
tags: added: ct2 support
description: updated
no longer affects: fuel/newton
Changed in fuel:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-library (master)

Fix proposed to branch: master
Review: https://review.openstack.org/359438

Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-library (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/359439

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-library (stable/mitaka)

Reviewed: https://review.openstack.org/359439
Committed: https://git.openstack.org/cgit/openstack/fuel-library/commit/?id=936c9767e14468202000ed3b7bfc12cd901e9d2b
Submitter: Jenkins
Branch: stable/mitaka

commit 936c9767e14468202000ed3b7bfc12cd901e9d2b
Author: Maksim Malchuk <email address hidden>
Date: Wed Aug 24 00:15:02 2016 +0300

    Fix MySQL logging dir permissions for syslog

    This change fixes permissions for MySQL logging directory to enable
    syslogd create and write logs files into it.

    Closes-Bug: #1615680
    Change-Id: Id29aead6619ea8ed68811d0fd80895ee79f51687
    Signed-off-by: Maksim Malchuk <email address hidden>
    (cherry picked from commit 9c978278811eeebfb11ab4d2b42ebabe00c132c2)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-library (master)

Reviewed: https://review.openstack.org/359438
Committed: https://git.openstack.org/cgit/openstack/fuel-library/commit/?id=3a09a055c3295130744b9171233b47dfc3b146f0
Submitter: Jenkins
Branch: master

commit 3a09a055c3295130744b9171233b47dfc3b146f0
Author: Maksim Malchuk <email address hidden>
Date: Wed Aug 24 00:15:02 2016 +0300

    Fix MySQL logging dir permissions for syslog

    This change fixes permissions for MySQL logging directory to enable
    syslogd create and write logs files into it.

    Closes-Bug: #1615680
    Change-Id: Id29aead6619ea8ed68811d0fd80895ee79f51687
    Signed-off-by: Maksim Malchuk <email address hidden>

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Dmitry Belyaninov (dbelyaninov) wrote :

Verified on snapshot #178
root@node-1:~# ll /var/log/mysql/
total 36
drwxrwx--- 2 mysql adm 4096 Aug 25 13:06 ./
drwxrwxr-x 23 root syslog 4096 Aug 25 13:21 ../
-rw-r----- 1 mysql adm 5517 Aug 25 13:05 error.log
-rw-r----- 1 syslog adm 20072 Aug 25 13:19 mysqld.log

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/fuel-library 10.0.0rc1

This issue was fixed in the openstack/fuel-library 10.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/fuel-library 10.0.0

This issue was fixed in the openstack/fuel-library 10.0.0 release.

Revision history for this message
TatyanaGladysheva (tgladysheva) wrote :

Verified on 10.0 build #1569.

root@node-1:~# ll /var/log/mysql/
total 224
drwxrwx--- 2 mysql adm 4096 Apr 6 06:52 ./
drwxrwxr-x 23 root syslog 4096 Apr 6 07:32 ../
-rw-r----- 1 mysql adm 0 Apr 6 06:52 error.log
-rw-r----- 1 syslog syslog 216546 Apr 6 11:58 mysqld.log

Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.