-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PostgresSQL module for Filebeat (#4763)
* filebeat: add PostgreSQL module This module includes a sample dashboard and two sample searches for Kibana. * filebeat: add PostgreSQL slowlog * system-tests: make it possible to test more than 10 logs Previously, only 10 logs could be in *.log and *-expected.json files, as it is the default page size of ES. However, to be more future proof the test was extended, so it can validate more than 10 logs and events.
- Loading branch information
Showing
23 changed files
with
1,446 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[filebeat-module-postgresql]] | ||
== PostgreSQL module | ||
|
||
This module collects and parses the logs created by https://www.postgresql.org/[PostgreSQL]. | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
The PostgreSQL module was tested with logs from versions 9.5 on Ubuntu and 9.6 on Debian. | ||
|
||
[float] | ||
=== Dashboard | ||
|
||
This module comes with two sample dashboards. | ||
|
||
The first dashboard is for regulars logs. | ||
|
||
image::./images/filebeat-postgresql-overview.png[] | ||
|
||
The second one shows the slowlogs of PostgreSQL. | ||
|
||
image::./images/filebeat-postgresql-postgresql-overview.png[] | ||
|
||
[float] | ||
=== Logs fileset settings | ||
|
||
[float] | ||
==== var.paths | ||
|
||
An array of paths where to look for the log files. If left empty, Filebeat | ||
will choose the paths depending on your operating systems. | ||
|
||
|
||
[float] | ||
=== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-postgresql,exported fields>> section. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#- module: postgresql | ||
# Logs | ||
#log: | ||
#enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: | ||
|
||
# Prospector configuration (advanced). Any prospector configuration option | ||
# can be added under this section. | ||
#prospector: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- module: postgresql | ||
# All logs | ||
log: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
== PostgreSQL module | ||
|
||
This module collects and parses the logs created by https://www.postgresql.org/[PostgreSQL]. | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
The PostgreSQL module was tested with logs from versions 9.5 on Ubuntu and 9.6 on Debian. | ||
|
||
[float] | ||
=== Dashboard | ||
|
||
This module comes with two sample dashboards. | ||
|
||
The first dashboard is for regulars logs. | ||
|
||
image::./images/filebeat-postgresql-overview.png[] | ||
|
||
The second one shows the slowlogs of PostgreSQL. | ||
|
||
image::./images/filebeat-postgresql-postgresql-overview.png[] | ||
|
||
[float] | ||
=== Logs fileset settings | ||
|
||
[float] | ||
==== var.paths | ||
|
||
An array of paths where to look for the log files. If left empty, Filebeat | ||
will choose the paths depending on your operating systems. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- key: postgresql | ||
title: "PostgreSQL" | ||
description: > | ||
Module for parsing the PostgreSQL log files. | ||
short_config: true | ||
fields: | ||
- name: postgresql | ||
type: group | ||
description: > | ||
Fields from PostgreSQL logs. | ||
fields: |
64 changes: 64 additions & 0 deletions
64
filebeat/module/postgresql/_meta/kibana/default/dashboard/Filebeat-Postgresql-overview.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"objects": [ | ||
{ | ||
"attributes": { | ||
"description": "", | ||
"kibanaSavedObjectMeta": { | ||
"searchSourceJSON": "{\"filter\":[]}" | ||
}, | ||
"savedSearchId": "ef9da9b0-776c-11e7-9e03-393c0d1aa325", | ||
"title": "PostgreSQL Log Level Count", | ||
"uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", | ||
"version": 1, | ||
"visState": "{\"title\":\"PostgreSQL Log Level Count\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMeticsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"postgresql.log.level\",\"size\":12,\"order\":\"desc\",\"orderBy\":\"1\"}}]}" | ||
}, | ||
"id": "28563b50-776d-11e7-9e03-393c0d1aa325", | ||
"type": "visualization", | ||
"version": 1 | ||
}, | ||
{ | ||
"attributes": { | ||
"columns": [ | ||
"postgresql.log.user", | ||
"postgresql.log.database", | ||
"postgresql.log.level", | ||
"postgresql.log.message", | ||
"postgresql.log.query" | ||
], | ||
"description": "", | ||
"hits": 0, | ||
"kibanaSavedObjectMeta": { | ||
"searchSourceJSON": "{\"index\":\"a0b887a0-763d-11e7-9e03-393c0d1aa325\",\"highlightAll\":true,\"version\":true,\"query\":{\"query\":\"postgresql.log.level:*\",\"language\":\"lucene\"},\"filter\":[]}" | ||
}, | ||
"sort": [ | ||
"@timestamp", | ||
"desc" | ||
], | ||
"title": "PostgreSQL All Logs", | ||
"version": 1 | ||
}, | ||
"id": "ef9da9b0-776c-11e7-9e03-393c0d1aa325", | ||
"type": "search", | ||
"version": 1 | ||
}, | ||
{ | ||
"attributes": { | ||
"description": "", | ||
"hits": 0, | ||
"kibanaSavedObjectMeta": { | ||
"searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" | ||
}, | ||
"optionsJSON": "{\"darkTheme\":false}", | ||
"panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"28563b50-776d-11e7-9e03-393c0d1aa325\",\"col\":1,\"row\":4},{\"size_x\":12,\"size_y\":3,\"panelIndex\":2,\"type\":\"search\",\"id\":\"ef9da9b0-776c-11e7-9e03-393c0d1aa325\",\"col\":1,\"row\":1,\"columns\":[\"postgresql.log.user\",\"postgresql.log.database\",\"postgresql.log.level\",\"postgresql.log.message\",\"postgresql.log.query\"],\"sort\":[\"@timestamp\",\"desc\"]}]", | ||
"timeRestore": false, | ||
"title": "PostgreSQL All Logs", | ||
"uiStateJSON": "{\"P-1\":{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}}", | ||
"version": 1 | ||
}, | ||
"id": "a21284c0-776e-11e7-9e03-393c0d1aa325", | ||
"type": "dashboard", | ||
"version": 1 | ||
} | ||
], | ||
"version": "6.0.0-beta1-SNAPSHOT" | ||
} |
Oops, something went wrong.