-
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.
Parse query steps in postgresql slowlog (#13701)
Slow logs in PostgreSQL can log information per query step. Parse and collect the query step and the assigned query name if present. Fix #13496
- Loading branch information
Showing
9 changed files
with
98 additions
and
5 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
3 changes: 3 additions & 0 deletions
3
filebeat/module/postgresql/log/test/postgresql-query-steps-slowlog.log
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,3 @@ | ||
2019-09-04 15:52:38.004 CEST [31136] user@host LOG: duration: 12.437 ms parse <unnamed>: select * from table | ||
2019-09-04 15:52:38.004 CEST [31136] user@host LOG: duration: 12.437 ms execute pdo_stmt_00000002: select * from table | ||
|
44 changes: 44 additions & 0 deletions
44
filebeat/module/postgresql/log/test/postgresql-query-steps-slowlog.log-expected.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,44 @@ | ||
[ | ||
{ | ||
"@timestamp": "2019-09-04T13:52:38.004Z", | ||
"event.dataset": "postgresql.log", | ||
"event.duration": 12437000, | ||
"event.module": "postgresql", | ||
"event.timezone": "CEST", | ||
"fileset.name": "log", | ||
"input.type": "log", | ||
"log.level": "LOG", | ||
"log.offset": 0, | ||
"message": "2019-09-04 15:52:38.004 CEST [31136] user@host LOG: duration: 12.437 ms parse <unnamed>: select * from table", | ||
"postgresql.log.database": "host", | ||
"postgresql.log.query": "select * from table", | ||
"postgresql.log.query_step": "parse", | ||
"postgresql.log.timestamp": "2019-09-04 15:52:38.004 CEST", | ||
"process.pid": 31136, | ||
"service.type": "postgresql", | ||
"user.name": "user" | ||
}, | ||
{ | ||
"@timestamp": "2019-09-04T13:52:38.004Z", | ||
"event.dataset": "postgresql.log", | ||
"event.duration": 12437000, | ||
"event.module": "postgresql", | ||
"event.timezone": "CEST", | ||
"fileset.name": "log", | ||
"input.type": "log", | ||
"log.flags": [ | ||
"multiline" | ||
], | ||
"log.level": "LOG", | ||
"log.offset": 111, | ||
"message": "2019-09-04 15:52:38.004 CEST [31136] user@host LOG: duration: 12.437 ms execute pdo_stmt_00000002: select * from table\n", | ||
"postgresql.log.database": "host", | ||
"postgresql.log.query": "select * from table\n", | ||
"postgresql.log.query_name": "pdo_stmt_00000002", | ||
"postgresql.log.query_step": "execute", | ||
"postgresql.log.timestamp": "2019-09-04 15:52:38.004 CEST", | ||
"process.pid": 31136, | ||
"service.type": "postgresql", | ||
"user.name": "user" | ||
} | ||
] |