使用 rsyslog v8.2.2,我想要对多行消息进行分组,例如 MySQL 慢查询日志输出的消息。
每条新消息以连续的三行开头,每行的第一个字符都是“#”,但有些消息只有两行,且消息开头都是“#”。(我怀疑由 PHP cli(而不是标准 PHP)触发的查询没有带 # Time:
标记)。 例子:
# Time: 140817 0:59:22
# User@Host: root[root] @ localhost []
# Query_time: 5.864315 Lock_time: 0.000033 Rows_sent: 857715 Rows_examined: 857715
SET timestamp=1408237162;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `sales_flat_quote_shipping_rate`;
# Time: 140817 1:00:06
# User@Host: user2[user2] @ localhost []
# Query_time: 4.070595 Lock_time: 0.000068 Rows_sent: 0 Rows_examined: 1536
use db2;
SET timestamp=1408237206;
DELETE FROM `catalog_product_index_price_idx`;
# User@Host: db3[db3] @ localhost []
# Query_time: 3.892674 Lock_time: 0.046493 Rows_sent: 0 Rows_examined: 659
use db3;
SET timestamp=1408237206;
UPDATE user SET cert = 'yes' WHERE site_id < 10;
# Time: 140817 1:00:06
# User@Host: user2[user2] @ localhost []
# Query_time: 4.070595 Lock_time: 0.000068 Rows_sent: 0 Rows_examined: 1536
use db2;
SET timestamp=1408237206;
DELETE FROM `catalog_product_index_price_idx`;
# User@Host: db3[db3] @ localhost []
# Query_time: 3.892674 Lock_time: 0.046493 Rows_sent: 0 Rows_examined: 659
use db3;
SET timestamp=1408237206;
UPDATE user SET cert = 'yes' WHERE site_id < 10;
如何配置 rsyslog 以将它们作为单个消息发送?