Hello,
I’ve setup slow logs to my pxe cluster, I’ve access them inside container :
bash-4.4$ tail -f /var/lib/mysql/db-pxc-db-pxc-0-slow.log
# Time: 2023-01-04T13:00:05.776667Z
# User@Host: root[root] @ 10-10-0-2.db-pxc-db-haproxy-replicas.svc.cluster.local [10.10.0.2] Id: 67708
# Schema: Last_errno: 0 Killed: 0
# Query_time: 2.000123 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes_sent: 63
SET timestamp=1672837203;
select sleep(20);
and outside container :
kubectl -n db logs -f --since=1m pod/sb-pxc-db-pxc-0 logs
...
{"file":"/var/lib/mysql/db-pxc-db-pxc-0-slow.log","log":"# Time: 2023-01-04T13:03:14.860669Z"}
{"file":"/var/lib/mysql/db-pxc-db-pxc-0-slow.log","log":"# User@Host: root[root] @ db-pxc-db-haproxy-1.db-pxc-db-haproxy.db.svc.cluster.local [10.0.0.2] Id: 68939"}
{"file":"/var/lib/mysql/db-pxc-db-pxc-0-slow.log","log":"# Schema: Last_errno: 0 Killed: 0"}
{"file":"/var/lib/mysql/db-pxc-db-pxc-0-slow.log","log":"# Query_time: 2.000185 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes_sent: 63"}
{"file":"/var/lib/mysql/db-pxc-db-pxc-0-slow.log","log":"SET timestamp=1672837392;"}
{"file":"/var/lib/mysql/sb-pxc-db-pxc-0-slow.log","log":"select sleep(2);"}
I would like to have logs in one line to push it to ES, like actually parser configured :
cat /etc/fluentbit/parsers_multiline.conf
[MULTILINE_PARSER]
name multiline-regex-test
type regex
flush_timeout 1000
#
# Regex rules for multiline parsing
# ---------------------------------
#
# configuration hints:
#
# - first state always has the name: start_state
# - every field in the rule must be inside double quotes
#
# rules | state name | regex pattern | next state
# ------|---------------|--------------------------------------------
rule "start_state" "/\d{2,4}\-\d{2,4}\-\d{2,4}T\d{2,4}\:\d{2,4}\:\d{2,4}\.\d{1,6}Z(.*)|\d{2,6} \d{2,4}\:\d{2,4}\:\d{2,4}(.*)/" "cont"
rule "cont" "/^\D/" "cont"
I didn’t found any doc, just code like this in cr.yaml
logcollector:
enabled: true
image: perconalab/percona-xtradb-cluster-operator:main-logcollector
# configuration: |
# [OUTPUT]
# Name es
# Match *
# Host 192.168.2.3
# Port 9200
# Index my_index
# Type my_type
Thanks