Skip to content

Commit

Permalink
Cherry-pick #15845 to 7.x: SQL module now supports key/value mode (#1…
Browse files Browse the repository at this point in the history
…5870)

There are some queries like mysql `SHOW STATUS` that display the
results in a key/value format so they need to be scanned in a different
way, being the key the first column of the response and the value the
second one.

(cherry picked from commit d8517c6)

Co-authored-by: Rodrigo Villablanca Vásquez <villa061004@gmail.com>
  • Loading branch information
jsoriano and rvillablanca authored Jan 27, 2020
1 parent f8022d5 commit e4f228c
Show file tree
Hide file tree
Showing 13 changed files with 1,479 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Enable script processor. {pull}14711[14711]
- Add mixer metricset for Istio Metricbeat module {pull}15696[15696]
- Add mesh metricset for Istio Metricbeat module{pull}15535[15535]
- Add `key/value` mode for SQL module. {issue}15770[15770] {pull]15845[15845]
- Add support for Unix socket in Memcached metricbeat module. {issue}13685[13685] {pull}15822[15822]
- Make the `system/cpu` metricset collect normalized CPU metrics by default. {issue}15618[15618] {pull}15729[15729]

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docs/modules/sql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metricbeat.modules:
driver: "postgres"
sql_query: "select now()"
sql_response_format: table
----

[float]
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ metricbeat.modules:

driver: "postgres"
sql_query: "select now()"

sql_response_format: table

#--------------------------------- Stan Module ---------------------------------
- module: stan
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/sql/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

driver: "postgres"
sql_query: "select now()"

sql_response_format: table
364 changes: 358 additions & 6 deletions x-pack/metricbeat/module/sql/query/_meta/data.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions x-pack/metricbeat/module/sql/query/_meta/data_mysql_tables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"event": {
"dataset": "sql.query",
"duration": 115000,
"module": "sql"
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "172.21.0.2:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {
"numeric": {
"table_rows": 1
},
"string": {
"engine": "MyISAM",
"table_name": "db",
"table_schema": "mysql"
}
},
"query": "select table_schema, table_name, engine, table_rows from information_schema.tables where table_rows \u003e 0;"
}
}
Loading

0 comments on commit e4f228c

Please sign in to comment.