From 3bed23c42da0b34969e3910c1f42f6fd89039608 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Fri, 18 Jan 2019 15:24:14 -0500 Subject: [PATCH] Update MySQL protocol to use ECS fields (#10155) That dashboard was updated too. Here's a summary of what fields changed. Part of #7968 Changed - bytes_in -> source.bytes - bytes_out -> destination.bytes - notes -> error.message - responsetime -> event.duration (unit are now nanoseconds) Added - destination - event.dataset = mysql - event.end - event.start - network.bytes - network.community_id - network.protocol = mysql - network.transport = tcp - network.type - source Removed - mysql.iserror - It was a boolean that reflected the same information as `status` which uses OK or Error. Unchanged Packetbeat Fields - method - query - params - path - status - type = mysql (we might remove this since we have event.dataset) --- CHANGELOG.next.asciidoc | 1 + dev-tools/ecs-migration.yml | 8 + .../kibana/6/dashboard/Packetbeat-mysql.json | 1964 ++++++++++------- packetbeat/docs/fields.asciidoc | 10 - packetbeat/protos/mysql/_meta/fields.yml | 5 - packetbeat/protos/mysql/fields.go | 2 +- packetbeat/protos/mysql/mysql.go | 84 +- packetbeat/protos/mysql/mysql_test.go | 5 +- .../tests/system/test_0001_mysql_spaces.py | 9 +- .../tests/system/test_0030_mysql_gap.py | 4 +- .../test_0064_mysql_prepare_statement.py | 4 +- 11 files changed, 1251 insertions(+), 845 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 9cca6b119f2..3b548ec567e 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -71,6 +71,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Changed AMQP protocol fields to align with ECS. {pull}10090[10090] - Changed Redis protocol fields to align with ECS. {pull}10126[10126] - Changed HTTP protocol fields to align with ECS. {pull}9976[9976] +- Changed MySQL protocol fields to align with ECS. {pull}10155[10155] - Changed NFS protocol fields to align with ECS. {pull}10153[10153] - Changed Thrift protocol fields to align with ECS. {pull}10125[10125] - Changed Cassandra protocol fields to align with ECS. {pull}10093[10093] diff --git a/dev-tools/ecs-migration.yml b/dev-tools/ecs-migration.yml index 35a8d0b8142..a748eb6e676 100644 --- a/dev-tools/ecs-migration.yml +++ b/dev-tools/ecs-migration.yml @@ -918,6 +918,14 @@ to: network.forwarded_ip alias: false +## MySQL +- from: mysql.iserror + to: status + alias: false + comment: > + Status reflects whether or not an error occured. Its values are either + OK or Error. + ## NFS - from: rpc.time to: event.duration diff --git a/packetbeat/_meta/kibana/6/dashboard/Packetbeat-mysql.json b/packetbeat/_meta/kibana/6/dashboard/Packetbeat-mysql.json index 7f3cab0447a..33597735353 100644 --- a/packetbeat/_meta/kibana/6/dashboard/Packetbeat-mysql.json +++ b/packetbeat/_meta/kibana/6/dashboard/Packetbeat-mysql.json @@ -1,792 +1,1198 @@ { - "objects": [ - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] - } - }, - "savedSearchId": "MySQL-errors", - "title": "MySQL Errors", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": {}, - "schema": "metric", - "type": "count" - }, - { - "id": "2", - "params": { - "customInterval": "2h", - "extended_bounds": {}, - "field": "@timestamp", - "interval": "auto", - "min_doc_count": 1 - }, - "schema": "segment", - "type": "date_histogram" - } - ], - "listeners": {}, - "params": { - "addLegend": false, - "addTimeMarker": false, - "addTooltip": true, - "defaultYExtents": false, - "interpolate": "linear", - "mode": "stacked", - "scale": "linear", - "setYExtents": false, - "shareYAxis": true, - "smoothLines": false, - "times": [], - "yAxis": {} - }, - "title": "MySQL Errors", - "type": "area" - } - }, - "id": "MySQL-Errors", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] - } - }, - "savedSearchId": "MySQL-Transactions", - "title": "MySQL Methods", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": {}, - "schema": "metric", - "type": "count" - }, - { - "id": "2", - "params": { - "customInterval": "2h", - "extended_bounds": {}, - "field": "@timestamp", - "interval": "auto", - "min_doc_count": 1 - }, - "schema": "segment", - "type": "date_histogram" - }, - { - "id": "3", - "params": { - "field": "method", - "order": "desc", - "orderBy": "1", - "size": 20 - }, - "schema": "group", - "type": "terms" - } - ], - "listeners": {}, - "params": { - "addLegend": true, - "addTimeMarker": false, - "addTooltip": true, - "defaultYExtents": false, - "interpolate": "linear", - "mode": "wiggle", - "scale": "linear", - "setYExtents": false, - "shareYAxis": true, - "smoothLines": false, - "times": [], - "yAxis": {} - }, - "title": "MySQL Methods", - "type": "area" + "objects": [ + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-errors", + "title": "MySQL Errors [Packetbeat]", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": {}, + "schema": "metric", + "type": "count" + }, + { + "enabled": true, + "id": "2", + "params": { + "customInterval": "2h", + "drop_partials": false, + "extended_bounds": {}, + "field": "@timestamp", + "interval": "auto", + "min_doc_count": 1, + "time_zone": "America/New_York", + "useNormalizedEsInterval": true + }, + "schema": "segment", + "type": "date_histogram" + } + ], + "params": { + "addLegend": false, + "addTimeMarker": false, + "addTooltip": true, + "categoryAxes": [ + { + "id": "CategoryAxis-1", + "labels": { + "show": true, + "truncate": 100 + }, + "position": "bottom", + "scale": { + "type": "linear" + }, + "show": true, + "style": {}, + "title": {}, + "type": "category" + } + ], + "defaultYExtents": false, + "grid": { + "categoryLines": false, + "style": { + "color": "#eee" + } + }, + "interpolate": "linear", + "legendPosition": "right", + "mode": "stacked", + "scale": "linear", + "seriesParams": [ + { + "data": { + "id": "1", + "label": "Count" + }, + "interpolate": "linear", + "mode": "stacked", + "show": "true", + "type": "area", + "valueAxis": "ValueAxis-1" + } + ], + "setYExtents": false, + "shareYAxis": true, + "smoothLines": false, + "times": [], + "type": "area", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "filter": false, + "rotate": 0, + "show": true, + "truncate": 100 + }, + "name": "LeftAxis-1", + "position": "left", + "scale": { + "defaultYExtents": false, + "mode": "normal", + "setYExtents": false, + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "Count" + }, + "type": "value" + } + ], + "yAxis": {} + }, + "title": "MySQL Errors [Packetbeat]", + "type": "area" + } + }, + "id": "MySQL-Errors", + "type": "visualization", + "updated_at": "2019-01-18T03:59:44.898Z", + "version": 2 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "MySQL Methods [Packetbeat]", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": {}, + "schema": "metric", + "type": "count" + }, + { + "enabled": true, + "id": "2", + "params": { + "customInterval": "2h", + "drop_partials": false, + "extended_bounds": {}, + "field": "@timestamp", + "interval": "auto", + "min_doc_count": 1, + "time_zone": "America/New_York", + "useNormalizedEsInterval": true + }, + "schema": "segment", + "type": "date_histogram" + }, + { + "enabled": true, + "id": "3", + "params": { + "field": "method", + "missingBucket": false, + "missingBucketLabel": "Missing", + "order": "desc", + "orderBy": "1", + "otherBucket": false, + "otherBucketLabel": "Other", + "size": 20 + }, + "schema": "group", + "type": "terms" + } + ], + "params": { + "addLegend": true, + "addTimeMarker": false, + "addTooltip": true, + "categoryAxes": [ + { + "id": "CategoryAxis-1", + "labels": { + "show": true, + "truncate": 100 + }, + "position": "bottom", + "scale": { + "type": "linear" + }, + "show": true, + "style": {}, + "title": {}, + "type": "category" + } + ], + "defaultYExtents": false, + "grid": { + "categoryLines": false, + "style": { + "color": "#eee" + } + }, + "interpolate": "linear", + "legendPosition": "right", + "mode": "wiggle", + "scale": "linear", + "seriesParams": [ + { + "data": { + "id": "1", + "label": "Count" + }, + "interpolate": "linear", + "mode": "stacked", + "show": "true", + "type": "area", + "valueAxis": "ValueAxis-1" + } + ], + "setYExtents": false, + "shareYAxis": true, + "smoothLines": false, + "times": [], + "type": "area", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "filter": false, + "rotate": 0, + "show": true, + "truncate": 100 + }, + "name": "LeftAxis-1", + "position": "left", + "scale": { + "defaultYExtents": false, + "mode": "wiggle", + "setYExtents": false, + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "Count" + }, + "type": "value" + } + ], + "yAxis": {} + }, + "title": "MySQL Methods [Packetbeat]", + "type": "area" + } + }, + "id": "MySQL-Methods", + "type": "visualization", + "updated_at": "2019-01-18T04:00:09.363Z", + "version": 2 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "lucene", + "query": { + "query_string": { + "analyze_wildcard": true, + "query": "*" } - }, - "id": "MySQL-Methods", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "lucene", - "query": { - "query_string": { - "analyze_wildcard": true, - "query": "*" - } - } + } + } + } + }, + "title": "Navigation", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "fontSize": "10", + "markdown": "### Packetbeat:\n\n[Overview](#/dashboard/Packetbeat-Dashboard)\n\n[Flows](#/dashboard/Packetbeat-Flows)\n\n[Web transactions](#/dashboard/Packetbeat-HTTP)\n\n[MySQL performance](#/dashboard/Packetbeat-MySQL-performance)\n\n[PostgreSQL performance](#/dashboard/Packetbeat-PgSQL-performance)\n\n[MongoDB performance](#/dashboard/Packetbeat-MongoDB-performance)\n\n[Thrift-RPC performance](#/dashboard/Packetbeat-Thrift-performance)\n\n[NFS transactions](#/dashboard/Packetbeat-NFS)\n\n[Cassandra performance](#/dashboard/Packetbeat-Cassandra)" + }, + "title": "Navigation", + "type": "markdown" + } + }, + "id": "Navigation", + "type": "visualization", + "updated_at": "2019-01-17T23:31:49.005Z", + "version": 10 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "MySQL throughput [Packetbeat]", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "field": "destination.bytes" + }, + "schema": "metric", + "type": "sum" + }, + { + "enabled": true, + "id": "3", + "params": { + "field": "source.bytes" + }, + "schema": "metric", + "type": "sum" + }, + { + "enabled": true, + "id": "4", + "params": { + "customInterval": "2h", + "drop_partials": false, + "extended_bounds": {}, + "field": "@timestamp", + "interval": "auto", + "min_doc_count": 1, + "time_zone": "America/New_York", + "useNormalizedEsInterval": true + }, + "schema": "segment", + "type": "date_histogram" + } + ], + "params": { + "addLegend": true, + "addTimeMarker": false, + "addTooltip": true, + "categoryAxes": [ + { + "id": "CategoryAxis-1", + "labels": { + "show": true, + "truncate": 100 + }, + "position": "bottom", + "scale": { + "type": "linear" + }, + "show": true, + "style": {}, + "title": {}, + "type": "category" + } + ], + "defaultYExtents": false, + "grid": { + "categoryLines": false, + "style": { + "color": "#eee" + } + }, + "legendPosition": "right", + "seriesParams": [ + { + "data": { + "id": "1", + "label": "Sum of destination.bytes" + }, + "mode": "normal", + "show": "true", + "type": "line", + "valueAxis": "ValueAxis-1" + }, + { + "data": { + "id": "3", + "label": "Sum of source.bytes" + }, + "mode": "normal", + "show": true, + "type": "line", + "valueAxis": "ValueAxis-1" + } + ], + "shareYAxis": true, + "times": [], + "type": "line", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "filter": false, + "rotate": 0, + "show": true, + "truncate": 100 + }, + "name": "LeftAxis-1", + "position": "left", + "scale": { + "defaultYExtents": false, + "mode": "normal", + "setYExtents": false, + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "Count" + }, + "type": "value" + } + ] + }, + "title": "MySQL throughput [Packetbeat]", + "type": "line" + } + }, + "id": "MySQL-throughput", + "type": "visualization", + "updated_at": "2019-01-18T04:02:04.959Z", + "version": 2 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [] + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "Most frequent MySQL queries", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "id": "1", + "params": {}, + "schema": "metric", + "type": "count" + }, + { + "id": "2", + "params": { + "field": "query", + "order": "desc", + "orderBy": "1", + "size": 10 + }, + "schema": "bucket", + "type": "terms" + } + ], + "listeners": {}, + "params": { + "perPage": 10, + "showMeticsAtAllLevels": false, + "showPartialRows": false + }, + "title": "Most frequent MySQL queries", + "type": "table" + } + }, + "id": "Most-frequent-MySQL-queries", + "type": "visualization", + "updated_at": "2019-01-17T23:31:43.873Z", + "version": 1 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "Slowest MySQL queries", + "uiStateJSON": { + "vis": { + "params": { + "sort": { + "columnIndex": null, + "direction": null + } + } + } + }, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "customLabel": "Avg Response Time", + "field": "event.duration" + }, + "schema": "metric", + "type": "avg" + }, + { + "enabled": true, + "id": "2", + "params": { + "field": "query", + "missingBucket": false, + "missingBucketLabel": "Missing", + "order": "desc", + "orderBy": "1", + "otherBucket": false, + "otherBucketLabel": "Other", + "size": 10 + }, + "schema": "bucket", + "type": "terms" + } + ], + "params": { + "perPage": 10, + "showMetricsAtAllLevels": false, + "showPartialRows": false, + "showTotal": false, + "sort": { + "columnIndex": null, + "direction": null + }, + "totalFunc": "sum" + }, + "title": "Slowest MySQL queries", + "type": "table" + } + }, + "id": "Slowest-MySQL-queries", + "type": "visualization", + "updated_at": "2019-01-18T04:02:38.938Z", + "version": 2 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "Mysql response times percentiles [Packetbeat]", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "field": "event.duration", + "percents": [ + 75, + 99, + 99.5 + ] + }, + "schema": "metric", + "type": "percentiles" + }, + { + "enabled": true, + "id": "2", + "params": { + "customInterval": "2h", + "drop_partials": false, + "extended_bounds": {}, + "field": "@timestamp", + "interval": "auto", + "min_doc_count": 1, + "time_zone": "America/New_York", + "useNormalizedEsInterval": true + }, + "schema": "segment", + "type": "date_histogram" + } + ], + "params": { + "addLegend": true, + "addTimeMarker": false, + "addTooltip": true, + "categoryAxes": [ + { + "id": "CategoryAxis-1", + "labels": { + "show": true, + "truncate": 100 + }, + "position": "bottom", + "scale": { + "type": "linear" + }, + "show": true, + "style": {}, + "title": {}, + "type": "category" + } + ], + "defaultYExtents": false, + "grid": { + "categoryLines": false, + "style": { + "color": "#eee" + } + }, + "legendPosition": "right", + "seriesParams": [ + { + "data": { + "id": "1", + "label": "Percentiles of event.duration" + }, + "mode": "normal", + "show": "true", + "type": "line", + "valueAxis": "ValueAxis-1" + } + ], + "shareYAxis": true, + "times": [], + "type": "line", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "filter": false, + "rotate": 0, + "show": true, + "truncate": 100 + }, + "name": "LeftAxis-1", + "position": "left", + "scale": { + "defaultYExtents": false, + "mode": "normal", + "setYExtents": false, + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "Percentiles of event.duration" + }, + "type": "value" + } + ] + }, + "title": "Mysql response times percentiles [Packetbeat]", + "type": "line" + } + }, + "id": "Mysql-response-times-percentiles", + "type": "visualization", + "updated_at": "2019-01-18T04:00:39.063Z", + "version": 2 + }, + { + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "savedSearchId": "MySQL-Transactions", + "title": "MySQL Reads vs Writes [Packetbeat]", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": {}, + "schema": "metric", + "type": "count" + }, + { + "enabled": true, + "id": "2", + "params": { + "customInterval": "2h", + "drop_partials": false, + "extended_bounds": {}, + "field": "@timestamp", + "interval": "auto", + "min_doc_count": 1, + "time_zone": "America/New_York", + "useNormalizedEsInterval": true + }, + "schema": "segment", + "type": "date_histogram" + }, + { + "enabled": true, + "id": "3", + "params": { + "filters": [ + { + "input": { + "query": { + "query_string": { + "analyze_wildcard": true, + "query": "method: SELECT" } + } } - }, - "title": "Navigation", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "fontSize": "10", - "markdown": "### Packetbeat:\n\n[Overview](#/dashboard/Packetbeat-Dashboard)\n\n[Flows](#/dashboard/Packetbeat-Flows)\n\n[Web transactions](#/dashboard/Packetbeat-HTTP)\n\n[MySQL performance](#/dashboard/Packetbeat-MySQL-performance)\n\n[PostgreSQL performance](#/dashboard/Packetbeat-PgSQL-performance)\n\n[MongoDB performance](#/dashboard/Packetbeat-MongoDB-performance)\n\n[Thrift-RPC performance](#/dashboard/Packetbeat-Thrift-performance)\n\n[NFS transactions](#/dashboard/Packetbeat-NFS)\n\n[Cassandra performance](#/dashboard/Packetbeat-Cassandra)" - }, - "title": "Navigation", - "type": "markdown" - } - }, - "id": "Navigation", - "type": "visualization", - "version": 10 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] + }, + { + "input": { + "query": "method: INSERT OR method: UPDATE OR method: DELETE" } - }, - "savedSearchId": "MySQL-Transactions", - "title": "MySQL throughput", - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": { - "field": "bytes_out" - }, - "schema": "metric", - "type": "sum" - }, - { - "id": "3", - "params": { - "field": "bytes_in" - }, - "schema": "metric", - "type": "sum" - }, - { - "id": "4", - "params": { - "extended_bounds": {}, - "field": "@timestamp", - "interval": "auto", - "min_doc_count": 1 - }, - "schema": "segment", - "type": "date_histogram" - } - ], - "listeners": {}, - "params": { - "addLegend": true, - "addTooltip": true, - "defaultYExtents": false, - "shareYAxis": true - }, - "type": "line" - } - }, - "id": "MySQL-throughput", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] + } + ] + }, + "schema": "group", + "type": "filters" + } + ], + "params": { + "addLegend": true, + "addTimeMarker": false, + "addTooltip": true, + "categoryAxes": [ + { + "id": "CategoryAxis-1", + "labels": { + "show": true, + "truncate": 100 + }, + "position": "bottom", + "scale": { + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "@timestamp per 30 seconds" + }, + "type": "category" + } + ], + "defaultYExtents": false, + "grid": { + "categoryLines": false, + "style": { + "color": "#eee" + } + }, + "interpolate": "linear", + "legendPosition": "right", + "mode": "stacked", + "scale": "linear", + "seriesParams": [ + { + "data": { + "id": "1", + "label": "Count" + }, + "drawLinesBetweenPoints": true, + "interpolate": "linear", + "mode": "stacked", + "show": "true", + "showCircles": true, + "type": "area", + "valueAxis": "ValueAxis-1" + } + ], + "setYExtents": false, + "shareYAxis": true, + "smoothLines": false, + "times": [], + "type": "area", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "filter": false, + "rotate": 0, + "show": true, + "truncate": 100 + }, + "name": "LeftAxis-1", + "position": "left", + "scale": { + "mode": "normal", + "type": "linear" + }, + "show": true, + "style": {}, + "title": { + "text": "Count" + }, + "type": "value" + } + ], + "yAxis": {} + }, + "title": "MySQL Reads vs Writes [Packetbeat]", + "type": "area" + } + }, + "id": "MySQL-Reads-vs-Writes", + "type": "visualization", + "updated_at": "2019-01-18T04:01:12.029Z", + "version": 2 + }, + { + "attributes": { + "columns": [ + "method", + "type", + "path", + "responsetime", + "status" + ], + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "packetbeat-*", + "key": "status", + "negate": true, + "params": { + "query": "OK", + "type": "phrase" + }, + "type": "phrase", + "value": "OK" + }, + "query": { + "match": { + "status": { + "query": "OK", + "type": "phrase" } - }, - "savedSearchId": "MySQL-Transactions", - "title": "Most frequent MySQL queries", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": {}, - "schema": "metric", - "type": "count" - }, - { - "id": "2", - "params": { - "field": "query", - "order": "desc", - "orderBy": "1", - "size": 10 - }, - "schema": "bucket", - "type": "terms" - } - ], - "listeners": {}, - "params": { - "perPage": 10, - "showMeticsAtAllLevels": false, - "showPartialRows": false - }, - "title": "Most frequent MySQL queries", - "type": "table" + } } - }, - "id": "Most-frequent-MySQL-queries", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] + }, + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "packetbeat-*", + "key": "event.dataset", + "negate": false, + "params": { + "query": "mysql", + "type": "phrase" + }, + "type": "phrase", + "value": "mysql" + }, + "query": { + "match": { + "event.dataset": { + "query": "mysql", + "type": "phrase" } - }, - "savedSearchId": "MySQL-Transactions", - "title": "Slowest MySQL queries", - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": { - "field": "responsetime" - }, - "schema": "metric", - "type": "avg" - }, - { - "id": "2", - "params": { - "field": "query", - "order": "desc", - "orderBy": "1", - "size": 10 - }, - "schema": "bucket", - "type": "terms" - } - ], - "listeners": {}, - "params": { - "perPage": 10, - "showMeticsAtAllLevels": false, - "showPartialRows": false - }, - "type": "table" + } } - }, - "id": "Slowest-MySQL-queries", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] - } - }, - "savedSearchId": "MySQL-Transactions", - "title": "Mysql response times percentiles", - "version": 1, - "visState": { - "aggs": [ - { - "id": "1", - "params": { - "field": "responsetime", - "percents": [ - 75, - 99, - 99.5 - ] - }, - "schema": "metric", - "type": "percentiles" - }, - { - "id": "2", - "params": { - "extended_bounds": {}, - "field": "@timestamp", - "interval": "auto", - "min_doc_count": 1 - }, - "schema": "segment", - "type": "date_histogram" - } - ], - "listeners": {}, - "params": { - "addLegend": true, - "addTooltip": true, - "defaultYExtents": false, - "shareYAxis": true - }, - "type": "line" + } + ], + "highlight": { + "fields": { + "*": {} + }, + "post_tags": [ + "@/kibana-highlighted-field@" + ], + "pre_tags": [ + "@kibana-highlighted-field@" + ] + }, + "highlightAll": true, + "index": "packetbeat-*", + "query": { + "language": "lucene", + "query": { + "query_string": { + "analyze_wildcard": true, + "query": "*" } - }, - "id": "Mysql-response-times-percentiles", - "type": "visualization", - "version": 1 - }, - { - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [] + } + }, + "version": true + } + }, + "sort": [ + "@timestamp", + "desc" + ], + "title": "MySQL Errors Search [Packetbeat]", + "version": 1 + }, + "id": "MySQL-errors", + "type": "search", + "updated_at": "2019-01-18T03:58:51.854Z", + "version": 2 + }, + { + "attributes": { + "columns": [ + "method", + "type", + "path", + "responsetime", + "status" + ], + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "packetbeat-*", + "key": "type", + "negate": false, + "params": { + "query": "mysql", + "type": "phrase" + }, + "type": "phrase", + "value": "mysql" + }, + "query": { + "match": { + "type": { + "query": "mysql", + "type": "phrase" } - }, - "savedSearchId": "MySQL-Transactions", - "title": "MySQL Reads vs Writes", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "enabled": true, - "id": "1", - "params": {}, - "schema": "metric", - "type": "count" - }, - { - "enabled": true, - "id": "2", - "params": { - "customInterval": "2h", - "extended_bounds": {}, - "field": "@timestamp", - "interval": "auto", - "min_doc_count": 1 - }, - "schema": "segment", - "type": "date_histogram" - }, - { - "enabled": true, - "id": "3", - "params": { - "filters": [ - { - "input": { - "query": { - "query_string": { - "analyze_wildcard": true, - "query": "method: SELECT" - } - } - } - }, - { - "input": { - "query": "method: INSERT OR method: UPDATE OR method: DELETE" - } - } - ] - }, - "schema": "group", - "type": "filters" - } - ], - "params": { - "addLegend": true, - "addTimeMarker": false, - "addTooltip": true, - "categoryAxes": [ - { - "id": "CategoryAxis-1", - "labels": { - "show": true, - "truncate": 100 - }, - "position": "bottom", - "scale": { - "type": "linear" - }, - "show": true, - "style": {}, - "title": { - "text": "@timestamp per 30 seconds" - }, - "type": "category" - } - ], - "defaultYExtents": false, - "grid": { - "categoryLines": false, - "style": { - "color": "#eee" - } - }, - "interpolate": "linear", - "legendPosition": "right", - "mode": "stacked", - "scale": "linear", - "seriesParams": [ - { - "data": { - "id": "1", - "label": "Count" - }, - "drawLinesBetweenPoints": true, - "interpolate": "linear", - "mode": "stacked", - "show": "true", - "showCircles": true, - "type": "area", - "valueAxis": "ValueAxis-1" - } - ], - "setYExtents": false, - "shareYAxis": true, - "smoothLines": false, - "times": [], - "type": "area", - "valueAxes": [ - { - "id": "ValueAxis-1", - "labels": { - "filter": false, - "rotate": 0, - "show": true, - "truncate": 100 - }, - "name": "LeftAxis-1", - "position": "left", - "scale": { - "mode": "normal", - "type": "linear" - }, - "show": true, - "style": {}, - "title": { - "text": "Count" - }, - "type": "value" - } - ], - "yAxis": {} - }, - "title": "MySQL Reads vs Writes", - "type": "area" + } } - }, - "id": "MySQL-Reads-vs-Writes", - "type": "visualization", - "version": 3 - }, - { - "attributes": { - "columns": [ - "method", - "type", - "path", - "responsetime", - "status" - ], - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [ - { - "meta": { - "disabled": false, - "index": "packetbeat-*", - "key": "type", - "negate": false, - "value": "mysql" - }, - "query": { - "match": { - "type": { - "query": "mysql", - "type": "phrase" - } - } - } - }, - { - "meta": { - "disabled": false, - "index": "packetbeat-*", - "key": "status", - "negate": true, - "value": "OK" - }, - "query": { - "match": { - "status": { - "query": "OK", - "type": "phrase" - } - } - } - } - ], - "highlight": { - "fields": { - "*": {} - }, - "post_tags": [ - "@/kibana-highlighted-field@" - ], - "pre_tags": [ - "@kibana-highlighted-field@" - ] - }, - "index": "packetbeat-*", - "query": { - "query_string": { - "analyze_wildcard": true, - "query": "*" - } - } - } - }, - "sort": [ - "@timestamp", - "desc" - ], - "title": "MySQL errors", - "version": 1 - }, - "id": "MySQL-errors", - "type": "search", - "version": 1 - }, - { - "attributes": { - "columns": [ - "method", - "type", - "path", - "responsetime", - "status" - ], - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [ - { - "$state": { - "store": "appState" - }, - "meta": { - "alias": null, - "disabled": false, - "index": "packetbeat-*", - "key": "type", - "negate": false, - "params": { - "query": "mysql", - "type": "phrase" - }, - "type": "phrase", - "value": "mysql" - }, - "query": { - "match": { - "type": { - "query": "mysql", - "type": "phrase" - } - } - } - } - ], - "highlight": { - "fields": { - "*": {} - }, - "post_tags": [ - "@/kibana-highlighted-field@" - ], - "pre_tags": [ - "@kibana-highlighted-field@" - ] - }, - "highlightAll": true, - "index": "packetbeat-*", - "query": { - "language": "lucene", - "query": { - "query_string": { - "analyze_wildcard": true, - "query": "*" - } - } - }, - "version": true - } - }, - "sort": [ - "@timestamp", - "desc" - ], - "title": "MySQL Transactions [Packetbeat]", - "version": 1 - }, - "id": "MySQL-Transactions", - "type": "search", - "version": 2 - }, - { - "attributes": { - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "highlightAll": true, - "query": { - "language": "lucene", - "query": { - "query_string": { - "analyze_wildcard": true, - "query": "*" - } - } - }, - "version": true - } - }, - "optionsJSON": { - "darkTheme": false - }, - "panelsJSON": [ - { - "col": 4, - "id": "MySQL-Errors", - "panelIndex": 1, - "row": 1, - "size_x": 5, - "size_y": 4, - "type": "visualization" - }, - { - "col": 9, - "id": "MySQL-Methods", - "panelIndex": 2, - "row": 1, - "size_x": 4, - "size_y": 4, - "type": "visualization" - }, - { - "col": 1, - "id": "Navigation", - "panelIndex": 3, - "row": 1, - "size_x": 3, - "size_y": 4, - "type": "visualization" - }, - { - "col": 7, - "id": "MySQL-throughput", - "panelIndex": 4, - "row": 8, - "size_x": 6, - "size_y": 3, - "type": "visualization" - }, - { - "col": 1, - "id": "Most-frequent-MySQL-queries", - "panelIndex": 5, - "row": 11, - "size_x": 6, - "size_y": 6, - "type": "visualization" - }, - { - "col": 7, - "id": "Slowest-MySQL-queries", - "panelIndex": 6, - "row": 11, - "size_x": 6, - "size_y": 6, - "type": "visualization" - }, - { - "col": 1, - "id": "Mysql-response-times-percentiles", - "panelIndex": 7, - "row": 5, - "size_x": 12, - "size_y": 3, - "type": "visualization" - }, - { - "col": 1, - "id": "MySQL-Reads-vs-Writes", - "panelIndex": 8, - "row": 8, - "size_x": 6, - "size_y": 3, - "type": "visualization" - } - ], - "timeRestore": false, - "title": "[Packetbeat] MySQL performance", - "uiStateJSON": { - "P-5": { - "vis": { - "params": { - "sort": { - "columnIndex": null, - "direction": null - } - } - } - }, - "P-6": { - "vis": { - "params": { - "sort": { - "columnIndex": null, - "direction": null - } - } - } - } - }, - "version": 1 - }, - "id": "Packetbeat-MySQL-performance", - "type": "dashboard", - "version": 3 - } - ], - "version": "6.0.0-beta1-SNAPSHOT" + } + ], + "highlight": { + "fields": { + "*": {} + }, + "post_tags": [ + "@/kibana-highlighted-field@" + ], + "pre_tags": [ + "@kibana-highlighted-field@" + ] + }, + "highlightAll": true, + "index": "packetbeat-*", + "query": { + "language": "lucene", + "query": { + "query_string": { + "analyze_wildcard": true, + "query": "*" + } + } + }, + "version": true + } + }, + "sort": [ + "@timestamp", + "desc" + ], + "title": "MySQL Transactions [Packetbeat]", + "version": 1 + }, + "id": "MySQL-Transactions", + "type": "search", + "updated_at": "2019-01-17T23:31:43.873Z", + "version": 1 + }, + { + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "highlightAll": true, + "query": { + "language": "lucene", + "query": { + "query_string": { + "analyze_wildcard": true, + "query": "*" + } + } + }, + "version": true + } + }, + "optionsJSON": { + "darkTheme": false + }, + "panelsJSON": [ + { + "gridData": { + "h": 20, + "i": "1", + "w": 20, + "x": 12, + "y": 0 + }, + "id": "MySQL-Errors", + "panelIndex": "1", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "gridData": { + "h": 20, + "i": "2", + "w": 16, + "x": 32, + "y": 0 + }, + "id": "MySQL-Methods", + "panelIndex": "2", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "gridData": { + "h": 20, + "i": "3", + "w": 12, + "x": 0, + "y": 0 + }, + "id": "Navigation", + "panelIndex": "3", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "gridData": { + "h": 15, + "i": "4", + "w": 24, + "x": 24, + "y": 35 + }, + "id": "MySQL-throughput", + "panelIndex": "4", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "embeddableConfig": { + "vis": { + "params": { + "sort": { + "columnIndex": null, + "direction": null + } + } + } + }, + "gridData": { + "h": 30, + "i": "5", + "w": 24, + "x": 0, + "y": 50 + }, + "id": "Most-frequent-MySQL-queries", + "panelIndex": "5", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "embeddableConfig": { + "vis": { + "params": { + "sort": { + "columnIndex": null, + "direction": null + } + } + } + }, + "gridData": { + "h": 30, + "i": "6", + "w": 24, + "x": 24, + "y": 50 + }, + "id": "Slowest-MySQL-queries", + "panelIndex": "6", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "gridData": { + "h": 15, + "i": "7", + "w": 48, + "x": 0, + "y": 20 + }, + "id": "Mysql-response-times-percentiles", + "panelIndex": "7", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + }, + { + "gridData": { + "h": 15, + "i": "8", + "w": 24, + "x": 0, + "y": 35 + }, + "id": "MySQL-Reads-vs-Writes", + "panelIndex": "8", + "type": "visualization", + "version": "7.0.0-SNAPSHOT" + } + ], + "timeRestore": false, + "title": "[Packetbeat] MySQL performance", + "version": 1 + }, + "id": "Packetbeat-MySQL-performance", + "type": "dashboard", + "updated_at": "2019-01-18T04:02:58.001Z", + "version": 2 + } + ], + "version": "7.0.0-SNAPSHOT" } \ No newline at end of file diff --git a/packetbeat/docs/fields.asciidoc b/packetbeat/docs/fields.asciidoc index 5d552d684f7..fd6e3dcea3c 100644 --- a/packetbeat/docs/fields.asciidoc +++ b/packetbeat/docs/fields.asciidoc @@ -6292,16 +6292,6 @@ MySQL-specific event fields. -*`mysql.iserror`*:: -+ --- -type: boolean - -If the MySQL query returns an error, this field is set to true. - - --- - *`mysql.affected_rows`*:: + -- diff --git a/packetbeat/protos/mysql/_meta/fields.yml b/packetbeat/protos/mysql/_meta/fields.yml index c5ed3795679..b66766ed0aa 100644 --- a/packetbeat/protos/mysql/_meta/fields.yml +++ b/packetbeat/protos/mysql/_meta/fields.yml @@ -6,11 +6,6 @@ - name: mysql type: group fields: - - name: iserror - type: boolean - description: > - If the MySQL query returns an error, this field is set to true. - - name: affected_rows type: long description: > diff --git a/packetbeat/protos/mysql/fields.go b/packetbeat/protos/mysql/fields.go index 42e846a100b..98b94f2db8d 100644 --- a/packetbeat/protos/mysql/fields.go +++ b/packetbeat/protos/mysql/fields.go @@ -31,5 +31,5 @@ func init() { // Asset returns asset data func Asset() string { - return "eJy8k0FvGyEQhe/7K55y6aXOD9hDL5UPkdJKrXO3MAw26gI2MzTaf1/BktTbrFtblcJlV8B78wFvVvhBYw8/8mnoAHEyUI+7L+Pm2+NdBxhindxRXAw9PnUAUNdWfCTtrNOgnxQE1tFg+L5D++vr1hWC8vTbvgwZj9Rjn2I+tplzxbnKMaUU0+v8i3YX40AqnM0vULbxYCEHmphxypRGJJKcAkMFVP+PkIPjiQKOwSSQCEmZ7rs3UMpa0kJmm+Izv0EbYthfxTUH09F7FabqWWtitnmYcekYRLnAVfTCMDMM2e8oIVoUsvItWwfFAhYl5CnIwnlcYEqydeYm7Ievm/X3p3ahV1I706Dm2PQ8jI2CTGFfgAzZb6eU3ES5WT+uP/+b8uzND9TucWYXbctoyw6ZC4x/ZOJdCeur/4Wv1rgO7ulAxW5q2wanirkysCn6SiFJBVa66D+UtVMmXgpY7bGtjob+o1sKUTVCMXo9Jnbj1EEX63piVnu6tYoLNqJpF6v9CgAA///kpYOQ" + return "eJy8k8GO0zAQhu95il974UL3AXLggnpYaUGC7j1y7XFrEdupZ0yVt0d20tJCCq2Q8CWRx/8/nz0zK3yjsYUf+dA3gDjpqcXTp3Hz5fWpAQyxTm4QF0OLDw0A1NiKB9LOOg36TkFgHfWGnxvMf209ukJQnn7alyXjQC12KeZh3rlUXKqUtaSFTJfikc/Rk0Mfw+5icwH0tF4sZE8TN3T0XgUDx+CsNTHb3L+H7B1PINAxiHKBq+jEcGUYst9SQrQoZOVbjvaKBSxKyFOQ5+a3+7jAlKRz5iHsl8+b9dc3HDKl8V5qZ2aoa2w69uNMQaawL0CG7LupIA9Rbtav649/pywREkisoukdr+yindsBiSSnQOYG4y898V8Ja9X/wFdz3Af3tqdiN03IDKeKuTKwKfpKIUkFVrro35XYIRMvNRilFFOno6F/mJZCVI1QjM7XxHacJuhmXk/MakePZnHBRszaxWw/AgAA//+Mhliv" } diff --git a/packetbeat/protos/mysql/mysql.go b/packetbeat/protos/mysql/mysql.go index 73ccd0d1b9b..d44088ce6c7 100644 --- a/packetbeat/protos/mysql/mysql.go +++ b/packetbeat/protos/mysql/mysql.go @@ -25,11 +25,11 @@ import ( "strings" "time" - "github.com/elastic/beats/libbeat/beat" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/monitoring" + "github.com/elastic/beats/packetbeat/pb" "github.com/elastic/beats/packetbeat/procs" "github.com/elastic/beats/packetbeat/protos" "github.com/elastic/beats/packetbeat/protos/tcp" @@ -87,17 +87,18 @@ type mysqlMessage struct { } type mysqlTransaction struct { - tuple common.TCPTuple - src common.Endpoint - dst common.Endpoint - responseTime int32 - ts time.Time - query string - method string - path string // for mysql, Path refers to the mysql table queried - bytesOut uint64 - bytesIn uint64 - notes []string + tuple common.TCPTuple + src common.Endpoint + dst common.Endpoint + ts time.Time + endTime time.Time + query string + method string + path string // for mysql, Path refers to the mysql table queried + bytesOut uint64 + bytesIn uint64 + notes []string + isError bool mysql common.MapStr @@ -759,10 +760,12 @@ func (mysql *mysqlPlugin) receivedMysqlResponse(msg *mysqlMessage) { "insert_id": msg.insertID, "num_rows": msg.numberOfRows, "num_fields": msg.numberOfFields, - "iserror": msg.isError, - "error_code": msg.errorCode, - "error_message": msg.errorInfo, }) + trans.isError = msg.isError + if trans.isError { + trans.mysql["error_code"] = msg.errorCode + trans.mysql["error_message"] = msg.errorInfo + } if msg.statementID != 0 { // cache prepare statement response info stmts := mysql.getStmtsMap(msg.tcpTuple.Hashable()) @@ -783,8 +786,7 @@ func (mysql *mysqlPlugin) receivedMysqlResponse(msg *mysqlMessage) { trans.bytesOut = msg.size trans.path = msg.tables - - trans.responseTime = int32(msg.ts.Sub(trans.ts).Nanoseconds() / 1e6) // resp_time in milliseconds + trans.endTime = msg.ts // save Raw message if len(msg.raw) > 0 { @@ -1152,41 +1154,49 @@ func (mysql *mysqlPlugin) publishTransaction(t *mysqlTransaction) { logp.Debug("mysql", "mysql.results exists") - fields := common.MapStr{} - fields["type"] = "mysql" + evt, pbf := pb.NewBeatEvent(t.ts) + pbf.SetSource(&t.src) + pbf.SetDestination(&t.dst) + pbf.Source.Bytes = int64(t.bytesIn) + pbf.Destination.Bytes = int64(t.bytesOut) + pbf.Event.Dataset = "mysql" + pbf.Event.Start = t.ts + pbf.Event.End = t.endTime + pbf.Network.Transport = "tcp" + pbf.Network.Protocol = "mysql" + + fields := evt.Fields + fields["type"] = pbf.Event.Dataset + fields["method"] = t.method + fields["query"] = t.query + fields["mysql"] = t.mysql + if len(t.path) > 0 { + fields["path"] = t.path + } + if len(t.params) > 0 { + fields["params"] = t.params + } - if t.mysql["iserror"].(bool) { + if t.isError { fields["status"] = common.ERROR_STATUS } else { fields["status"] = common.OK_STATUS } - fields["responsetime"] = t.responseTime if mysql.sendRequest { fields["request"] = t.requestRaw } if mysql.sendResponse { fields["response"] = t.responseRaw } - fields["method"] = t.method - fields["query"] = t.query - fields["params"] = t.params - fields["mysql"] = t.mysql - fields["path"] = t.path - fields["bytes_out"] = t.bytesOut - fields["bytes_in"] = t.bytesIn - if len(t.notes) > 0 { - fields["notes"] = t.notes + if len(t.notes) == 1 { + evt.PutValue("error.message", t.notes[0]) + } else if len(t.notes) > 1 { + evt.PutValue("error.message", t.notes) } - fields["src"] = &t.src - fields["dst"] = &t.dst - - mysql.results(beat.Event{ - Timestamp: t.ts, - Fields: fields, - }) + mysql.results(evt) } func readLstring(data []byte, offset int) ([]byte, int, bool, error) { diff --git a/packetbeat/protos/mysql/mysql_test.go b/packetbeat/protos/mysql/mysql_test.go index 59cc81cff2e..195ec694632 100644 --- a/packetbeat/protos/mysql/mysql_test.go +++ b/packetbeat/protos/mysql/mysql_test.go @@ -552,8 +552,9 @@ func Test_gap_in_response(t *testing.T) { assert.Equal(t, true, drop) trans := expectTransaction(t, store) - assert.NotNil(t, trans) - assert.Equal(t, []string{"Packet loss while capturing the response"}, trans["notes"]) + if m, err := trans.GetValue("error.message"); assert.NoError(t, err) { + assert.Equal(t, m, "Packet loss while capturing the response") + } } // Test that loss of data during the request doesn't result in a diff --git a/packetbeat/tests/system/test_0001_mysql_spaces.py b/packetbeat/tests/system/test_0001_mysql_spaces.py index ebdee96100f..5bcbe2f161c 100644 --- a/packetbeat/tests/system/test_0001_mysql_spaces.py +++ b/packetbeat/tests/system/test_0001_mysql_spaces.py @@ -16,21 +16,18 @@ def test_mysql_with_spaces(self): assert all([o["server.port"] == 3306 for o in objs]) assert objs[0]["method"] == "SET" - assert objs[0]["path"] == "" assert objs[0]["status"] == "OK" assert objs[2]["method"] == "DROP" - assert objs[2]["mysql.iserror"] is False assert objs[2]["status"] == "OK" assert objs[3]["method"] == "CREATE" - assert objs[3]["mysql.iserror"] is False assert objs[3]["status"] == "OK" assert objs[5]["method"] == "SELECT" assert objs[5]["path"] == "test.test" assert objs[5]["status"] == "OK" - assert objs[5]["bytes_out"] == 118 + assert objs[5]["destination.bytes"] == 118 - assert all(["bytes_in" in o.keys() for o in objs]) - assert all(["bytes_out" in o.keys() for o in objs]) + assert all(["source.bytes" in o.keys() for o in objs]) + assert all(["destination.bytes" in o.keys() for o in objs]) diff --git a/packetbeat/tests/system/test_0030_mysql_gap.py b/packetbeat/tests/system/test_0030_mysql_gap.py index 0b2d8e46242..aab7d096ec9 100644 --- a/packetbeat/tests/system/test_0030_mysql_gap.py +++ b/packetbeat/tests/system/test_0030_mysql_gap.py @@ -25,6 +25,4 @@ def test_gap_in_large_file(self): assert o["method"] == "SELECT" assert o["mysql.num_rows"] > 1 - print(o["notes"]) - assert len(o["notes"]) == 1 - assert o["notes"][0] == "Packet loss while capturing the response" + assert o["error.message"] == "Packet loss while capturing the response" diff --git a/packetbeat/tests/system/test_0064_mysql_prepare_statement.py b/packetbeat/tests/system/test_0064_mysql_prepare_statement.py index a6a0085e66f..a3d0a0a3157 100644 --- a/packetbeat/tests/system/test_0064_mysql_prepare_statement.py +++ b/packetbeat/tests/system/test_0064_mysql_prepare_statement.py @@ -20,5 +20,5 @@ def test_mysql_prepare_statement(self): assert objs[1]["params"][0] == "A1224638" assert objs[1]["mysql.num_rows"] == 1 - assert all(["bytes_in" in o.keys() for o in objs]) - assert all(["bytes_out" in o.keys() for o in objs]) + assert all(["source.bytes" in o.keys() for o in objs]) + assert all(["destination.bytes" in o.keys() for o in objs])