MySQL error log(PLC)
1. rsyslog conf 設定
1-1. 設定
vi /etc/rsyslog.d/80-mysql.conf#variables required for non-syslog log file forwarding – mysql error
#edit on your location
input(type=”imfile”
File=”/var/log/mysqld.log”
Tag=”mysqld-errors”
Severity=”error”
Facility=”local7″)
input(type=”imfile”
File=”/var/log/mysql-slow.log”
Tag=”mysql-slow”
Severity=”notice”
Facility=”local7″)
###### Creates a template for each log file in the Logentries UI
### logic to apply the relevant templates to the different log files
if $programname == ‘mysqld-errors’ then /var/log/plura/ceelog-127.0.0.1.log;CEETemplate
:programname, isequal, “mysqld-errors” ~
if $programname == ‘mysql-slow’ then /var/log/plura/ceelog-127.0.0.1.log;CEETemplate
:programname, isequal, “mysql-slow” ~1-2. rsyslog デーモン再起動
1-3. PLURA V5 repoからダウンロードする
2. MySQL – SLOW QUERY 設定
2-1. 設定
2-2. ログ ファイルの作成と権限設定
2-3. 権限確認
2-4. mysql デーモン再起動
2-5. 活性化確認

3. ログ確認
ErrorまたはSlow Query発生後、ホストログからMySQL関連ログを確認
ログ例 : 全体ログ > ホスト

参考サイト
https://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html
Last updated