forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support mariadb slowlog (elastic#9731) (elastic#10167)
Add support for MariaDB in the Filebeat module for MySQL. slowlog grok pattern is modified to support more versions of this log file and to make it easier to support more in the future. More example files are added to test this. (cherry picked from commit 4140305) Co-authored-by: Rodrigo Floriano de Souza <rodrigochurrops@gmail.com>
- Loading branch information
Showing
14 changed files
with
361 additions
and
7 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
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Time: 180613 11:04:36 | ||
# User@Host: root[root] @ localhost [121.0.0.1] | ||
# Thread_id: 5 Schema: QC_hit: No | ||
# Query_time: 2.000652 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 | ||
SET timestamp=1528898676; | ||
select sleep(2); |
26 changes: 26 additions & 0 deletions
26
filebeat/module/mysql/slowlog/test/mariadb-10.1.21.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,26 @@ | ||
[ | ||
{ | ||
"@timestamp": "2018-06-13T14:04:36.000Z", | ||
"event.dataset": "mysql.slowlog", | ||
"fileset.module": "mysql", | ||
"fileset.name": "slowlog", | ||
"input.type": "log", | ||
"log.flags": [ | ||
"multiline" | ||
], | ||
"mysql.slowlog.current_user": "root", | ||
"mysql.slowlog.host": "localhost", | ||
"mysql.slowlog.id": "5", | ||
"mysql.slowlog.ip": "121.0.0.1", | ||
"mysql.slowlog.lock_time.sec": "0.000000", | ||
"mysql.slowlog.query": "select sleep(2);", | ||
"mysql.slowlog.query_cache_hit": false, | ||
"mysql.slowlog.query_time.sec": "2.000652", | ||
"mysql.slowlog.rows_examined": "0", | ||
"mysql.slowlog.rows_sent": "1", | ||
"mysql.slowlog.timestamp": "1528898676", | ||
"mysql.slowlog.user": "root", | ||
"offset": 24, | ||
"prospector.type": "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,23 @@ | ||
mysqld, Version: 10.2.12-MariaDB-10.2.12+maria~jessie-log (mariadb.org binary distribution). started with: | ||
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock | ||
Time Id Command Argument | ||
mysqld, Version: 10.2.12-MariaDB-10.2.12+maria~jessie-log (mariadb.org binary distribution). started with: | ||
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock | ||
Time Id Command Argument | ||
# Time: 190117 16:04:03 | ||
# User@Host: root[root] @ localhost [] | ||
# Thread_id: 8 Schema: QC_hit: No | ||
# Query_time: 2.000227 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 | ||
# Rows_affected: 0 | ||
SET timestamp=1547741043; | ||
select sleep(2) | ||
AS foo; | ||
# Time: 190117 16:04:18 | ||
# User@Host: root[root] @ [192.168.0.10] | ||
# Thread_id: 25844 Schema: blah QC_hit: No | ||
# Query_time: 178.306017 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 53022772 | ||
# Rows_affected: 3062 | ||
# Full_scan: Yes Full_join: No Tmp_table: Yes Tmp_table_on_disk: No | ||
# Filesort: Yes Filesort_on_disk: No Merge_passes: 0 Priority_queue: No | ||
SET timestamp=1547741058; | ||
call PROC('blah'); |
59 changes: 59 additions & 0 deletions
59
filebeat/module/mysql/slowlog/test/mariadb-10.2.12.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,59 @@ | ||
[ | ||
{ | ||
"@timestamp": "2019-01-17T16:04:03.000Z", | ||
"event.dataset": "mysql.slowlog", | ||
"fileset.module": "mysql", | ||
"fileset.name": "slowlog", | ||
"input.type": "log", | ||
"log.flags": [ | ||
"multiline" | ||
], | ||
"mysql.slowlog.current_user": "root", | ||
"mysql.slowlog.host": "localhost", | ||
"mysql.slowlog.id": "8", | ||
"mysql.slowlog.lock_time.sec": "0.000000", | ||
"mysql.slowlog.query": "select sleep(2)\nAS foo;", | ||
"mysql.slowlog.query_cache_hit": false, | ||
"mysql.slowlog.query_time.sec": "2.000227", | ||
"mysql.slowlog.rows_affected": "0", | ||
"mysql.slowlog.rows_examined": "0", | ||
"mysql.slowlog.rows_sent": "1", | ||
"mysql.slowlog.timestamp": "1547741043", | ||
"mysql.slowlog.user": "root", | ||
"offset": 437, | ||
"prospector.type": "log" | ||
}, | ||
{ | ||
"@timestamp": "2019-01-17T16:04:18.000Z", | ||
"event.dataset": "mysql.slowlog", | ||
"fileset.module": "mysql", | ||
"fileset.name": "slowlog", | ||
"input.type": "log", | ||
"log.flags": [ | ||
"multiline" | ||
], | ||
"mysql.slowlog.current_user": "root", | ||
"mysql.slowlog.filesort": true, | ||
"mysql.slowlog.filesort_on_disk": false, | ||
"mysql.slowlog.full_join": false, | ||
"mysql.slowlog.full_scan": true, | ||
"mysql.slowlog.id": "25844", | ||
"mysql.slowlog.ip": "192.168.0.10", | ||
"mysql.slowlog.lock_time.sec": "0.000000", | ||
"mysql.slowlog.merge_passes": "0", | ||
"mysql.slowlog.priority_queue": false, | ||
"mysql.slowlog.query": "call PROC('blah');", | ||
"mysql.slowlog.query_cache_hit": false, | ||
"mysql.slowlog.query_time.sec": "178.306017", | ||
"mysql.slowlog.rows_affected": "3062", | ||
"mysql.slowlog.rows_examined": "53022772", | ||
"mysql.slowlog.rows_sent": "0", | ||
"mysql.slowlog.schema": "blah", | ||
"mysql.slowlog.timestamp": "1547741058", | ||
"mysql.slowlog.tmp_table": true, | ||
"mysql.slowlog.tmp_table_on_disk": false, | ||
"mysql.slowlog.user": "root", | ||
"offset": 682, | ||
"prospector.type": "log" | ||
} | ||
] |
Oops, something went wrong.