Hello,
I am using PostgreSQL 12 with Filebeat 7.12. I followed (PostgreSQL module | Filebeat Reference [8.11] | Elastic) to configure filebeat. Right now Filebeat is sending the logs but I can see, there is a GROK failure and not all PostgreSQL dashboards are working.
Here is my filebeat confing:
filebeat.inputs:
- type: log
enabled: false
paths:
- /var/log/*.log
- type: filestream
enabled: false
paths:
- /var/log/.log
filebeat.config.modules:
path: ${path.config}/modules.d/.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 1
setup.ilm.enabled: true
setup.ilm.rollover_alias: "filebeat-servername"
setup.ilm.pattern: "{now/d}"
setup.dashboards.enabled: true
setup.kibana:
host: "kibana:5601"
output.elasticsearch:
hosts: ["elastic:9200"]
processors:- add_host_metadata:
when.not.contains.tags: forwarded- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_kubernetes_metadata: ~
Here is my filebeat postgresql module config:
- module: postgresql
log:
enabled: true
var.paths: ["/data/pgsql/patroni/log/*.log"]
Here is error
{
"_index": "filebeat-servername-2021.05.17",
"_type": "_doc",
"_id": "aLp7f3kBXre3GWy8Jlop",
"_version": 1,
"_score": null,
"fields": {
"agent.version.keyword": [
"7.12.1"
],
"host.architecture.keyword": [
"x86_64"
],
"host.name.keyword": [
"servername"
],
"event.dataset.keyword": [
"postgresql.log"
],
"host.hostname": [
"servername"
],
"host.mac": [
"00:50:56:9a:39:bc"
],
"agent.hostname.keyword": [
"servername"
],
"service.type": [
"postgresql"
],
"ecs.version.keyword": [
"1.8.0"
],
"host.ip.keyword": [
"11.22.33.444",
"fe80::7f85:b9e:ec18:70d5"
],
"host.os.version": [
"7 (Core)"
],
"host.os.name": [
"CentOS Linux"
],
"agent.name": [
"servername"
],
"host.id.keyword": [
"8e08bb3b0d484afea7697b5308c72831"
],
"host.name": [
"servername"
],
"host.os.version.keyword": [
"7 (Core)"
],
"host.os.type": [
"linux"
],
"agent.id.keyword": [
"afcf8273-3ef8-4b70-9885-c0524458fca4"
],
"fileset.name": [
"log"
],
"input.type": [
"log"
],
"log.offset": [
171762268
],
"agent.hostname": [
"servername"
],
"host.architecture": [
"x86_64"
],
"fileset.name.keyword": [
"log"
],
"agent.id": [
"afcf8273-3ef8-4b70-9885-c0524458fca4"
],
"ecs.version": [
"1.8.0"
],
"host.containerized": [
false
],
"event.module.keyword": [
"postgresql"
],
"host.hostname.keyword": [
"servername"
],
"agent.version": [
"7.12.1"
],
"host.os.family": [
"redhat"
],
"service.type.keyword": [
"postgresql"
],
"input.type.keyword": [
"log"
],
"host.ip": [
"11.22.33.444",
"fe80::7f85:b9e:ec18:70d5"
],
"agent.type": [
"filebeat"
],
"event.module": [
"postgresql"
],
"host.os.kernel.keyword": [
"5.4.108-1.el7.elrepo.x86_64"
],
"host.os.kernel": [
"5.4.108-1.el7.elrepo.x86_64"
],
"host.os.name.keyword": [
"CentOS Linux"
],
"host.id": [
"8e08bb3b0d484afea7697b5308c72831"
],
"log.file.path.keyword": [
"/data/pgsql/patroni/log/postgresql-Tue.log"
],
"agent.type.keyword": [
"filebeat"
],
"agent.ephemeral_id.keyword": [
"04d7fc98-524a-4916-8959-0aa5b14662b2"
],
"host.os.codename.keyword": [
"Core"
],
"host.mac.keyword": [
"00:50:56:9a:39:bc"
],
"agent.name.keyword": [
"servername"
],
"host.os.codename": [
"Core"
],
"message": [
"2021-05-18 15:37:32.073 +03 [78544] postgres@postgres LOG: duration: 0.783 ms statement: SELECT pg_catalog.to_char(pg_catalog.pg_postmaster_start_time(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'), CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE ('x' || pg_catalog.substr(pg_catalog.pg_walfile_name(pg_catalog.pg_current_wal_lsn()), 1, 8))::bit(32)::int END, CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), '0/0')::bigint END, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_replay_lsn(), '0/0')::bigint, pg_catalog.pg_wal_lsn_diff(COALESCE(pg_catalog.pg_last_wal_receive_lsn(), '0/0'), '0/0')::bigint, pg_catalog.pg_is_in_recovery() AND pg_catalog.pg_is_wal_replay_paused(), pg_catalog.to_char(pg_catalog.pg_last_xact_replay_timestamp(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'), pg_catalog.array_to_json(pg_catalog.array_agg(pg_catalog.row_to_json(ri))) FROM (SELECT (SELECT rolname FROM pg_authid WHERE oid = usesysid) AS usename, application_name, client_addr, w.state, sync_state, sync_priority FROM pg_catalog.pg_stat_get_wal_senders() w, pg_catalog.pg_stat_get_activity(pid)) AS ri"
],
"host.os.family.keyword": [
"redhat"
],
"event.ingested": [
"2021-05-18T12:37:27.720Z"
],
"@timestamp": [
"2021-05-18T12:37:32.772Z"
],
"host.os.type.keyword": [
"linux"
],
"host.os.platform": [
"centos"
],
"host.os.platform.keyword": [
"centos"
],
"error.message": [
"Provided Grok expressions do not match field value: [2021-05-18 15:37:32.073 +03 [78544] postgres@postgres LOG: duration: 0.783 ms statement: SELECT pg_catalog.to_char(pg_catalog.pg_postmaster_start_time(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'), CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE ('x' || pg_catalog.substr(pg_catalog.pg_walfile_name(pg_catalog.pg_current_wal_lsn()), 1, 8))::bit(32)::int END, CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), '0/0')::bigint END, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_replay_lsn(), '0/0')::bigint, pg_catalog.pg_wal_lsn_diff(COALESCE(pg_catalog.pg_last_wal_receive_lsn(), '0/0'), '0/0')::bigint, pg_catalog.pg_is_in_recovery() AND pg_catalog.pg_is_wal_replay_paused(), pg_catalog.to_char(pg_catalog.pg_last_xact_replay_timestamp(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'), pg_catalog.array_to_json(pg_catalog.array_agg(pg_catalog.row_to_json(ri))) FROM (SELECT (SELECT rolname FROM pg_authid WHERE oid = usesysid) AS usename, application_name, client_addr, w.state, sync_state, sync_priority FROM pg_catalog.pg_stat_get_wal_senders() w, pg_catalog.pg_stat_get_activity(pid)) AS ri]"
],
"log.file.path": [
"/data/pgsql/patroni/log/postgresql-Tue.log"
],
"agent.ephemeral_id": [
"04d7fc98-524a-4916-8959-0aa5b14662b2"
],
"event.dataset": [
"postgresql.log"
]
},
"highlight": {
"agent.name": [
"@kibana-highlighted-field@servername@/kibana-highlighted-field@"
]
},
"sort": [
1621341452772
]
}
What could be the problem? Thank you.