1 redis日志内容如下
124741:M 04 Feb 14:31:06.589 * Marking node 6b260964244b6d955783ca0abef1582dd1873af9 as failing (quorum reached).
124741:M 04 Feb 14:31:07.309 # Failover auth granted to 2c5e6f8010e32c44cc2e58b458d1b94111e1ccbc for epoch 5
124741:M 04 Feb 14:31:08.560 * Clear FAIL state for node 6b260964244b6d955783ca0abef1582dd1873af9: master without slots is reachable again.
124741:M 04 Feb 14:32:08.804 * FAIL message received from 2c5e6f8010e32c44cc2e58b458d1b94111e1ccbc about 6b260964244b6d955783ca0abef1582dd1873af9
124741:M 04 Feb 14:32:27.785 * Clear FAIL state for node 6b260964244b6d955783ca0abef1582dd1873af9: slave is reachable again.
以下面这一行举例,
124741:表示redis的pid,
M:表示角色。角色对应关系
(
‘X’ => ‘Sentinel’,
‘C’ => ‘RDB / AOF writing child’,
‘S’ => ‘Slave’,
‘M’ => ‘Master’
);
04 Feb 14:31:06.589:日 月 时:分:秒.毫秒
:日志级别
(
‘.’ => ‘LOG_DEBUG’,
‘-’=> ‘LOG_INFO’,
'’ => ‘LOG_NOTICE’,
‘#’ => ‘LOG_WARNING’,
);
msg:后面是消息
124741:M 04 Feb 14:31:06.589 * Marking node 6b260964244b6d955783ca0abef1582dd1873af9 as failing (quorum reached).
php解析redis日志变成csv文件
explainRedisLog.php
<?php
$levelMap = array(
'.' => 'LOG_DEBUG',
'-'=> 'LOG_INFO',
'*' => 'LOG_NOTICE',
'#' => 'LOG_WARNING',
);
$roleMap = array(
'X' =>