diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a5a3c8e98316..297e171e8159 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -124,6 +124,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Update a few elasticsearch.* fields to map to ECS. {pull}10350[10350] - Update a few logstash.* fields to map to ECS. {pull}10350[10350] - Update a few kibana.* fields to map to ECS. {pull}10350[10350] +- Update rabbitmq.* fields to map to ECS. {pull}10563[10563] - Update haproxy.* fields to map to ECS. {pull}10558[10558] {pull}10568[10568] *Packetbeat* diff --git a/dev-tools/ecs-migration.yml b/dev-tools/ecs-migration.yml index 39c08d640918..810dd246bf97 100644 --- a/dev-tools/ecs-migration.yml +++ b/dev-tools/ecs-migration.yml @@ -1683,6 +1683,44 @@ alias: true beat: metricbeat +### Rabbitmq + +- from: rabbitmq.connection.node + to: rabbitmq.node.name + alias: true + beat: metricbeat + +- from: rabbitmq.connection.vhost + to: rabbitmq.vhost + alias: true + beat: metricbeat + +- from: rabbitmq.connection.user + to: user.name + alias: true + beat: metricbeat + +- from: rabbitmq.exchange.vhost + to: rabbitmq.vhost + alias: true + beat: metricbeat + +- from: rabbitmq.exchange.user + to: user.name + alias: true + beat: metricbeat + +- from: rabbitmq.queue.node + to: rabbitmq.node.name + alias: true + beat: metricbeat + +- from: rabbitmq.queue.vhost + to: rabbitmq.vhost + alias: true + beat: metricbeat + + ### Redis - from: php_fpm.status.pid diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 59024912a927..31da4dcbe233 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -19833,6 +19833,26 @@ RabbitMQ module +*`rabbitmq.node.name`*:: ++ +-- +type: keyword + +Node name + + +-- + +*`rabbitmq.vhost`*:: ++ +-- +type: keyword + +Virtual host name with non-ASCII characters escaped as in C. + + +-- + [float] == connection fields @@ -19843,7 +19863,9 @@ connection *`rabbitmq.connection.name`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.name The name of the connection with non-ASCII characters escaped as in C. @@ -19853,7 +19875,9 @@ The name of the connection with non-ASCII characters escaped as in C. *`rabbitmq.connection.vhost`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.vhost Virtual host name with non-ASCII characters escaped as in C. @@ -19863,7 +19887,9 @@ Virtual host name with non-ASCII characters escaped as in C. *`rabbitmq.connection.user`*:: + -- -type: keyword +type: alias + +alias to: user.name User name. @@ -19873,7 +19899,9 @@ User name. *`rabbitmq.connection.node`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.node.name Node name. @@ -20032,7 +20060,9 @@ The name of the queue with non-ASCII characters escaped as in C. *`rabbitmq.exchange.vhost`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.vhost Virtual host name with non-ASCII characters escaped as in C. @@ -20072,7 +20102,9 @@ Whether the exchange is internal, i.e. cannot be directly published to by a clie *`rabbitmq.exchange.user`*:: + -- -type: keyword +type: alias + +alias to: user.name User who created the exchange. @@ -20391,7 +20423,9 @@ Number of messages which have been written to the message store. *`rabbitmq.node.name`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.node.name Node name @@ -20528,7 +20562,9 @@ The name of the queue with non-ASCII characters escaped as in C. *`rabbitmq.queue.vhost`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.vhost Virtual host name with non-ASCII characters escaped as in C. @@ -20568,7 +20604,9 @@ Whether the queue is exclusive (i.e. has owner_pid). *`rabbitmq.queue.node`*:: + -- -type: keyword +type: alias + +alias to: rabbitmq.node.name Node name. diff --git a/metricbeat/module/rabbitmq/_meta/fields.yml b/metricbeat/module/rabbitmq/_meta/fields.yml index 12ba67ee0de3..f964967e8e45 100644 --- a/metricbeat/module/rabbitmq/_meta/fields.yml +++ b/metricbeat/module/rabbitmq/_meta/fields.yml @@ -9,3 +9,12 @@ type: group description: > fields: + - name: node.name + type: keyword + description: > + Node name + + - name: vhost + type: keyword + description: > + Virtual host name with non-ASCII characters escaped as in C. diff --git a/metricbeat/module/rabbitmq/connection/_meta/data.json b/metricbeat/module/rabbitmq/connection/_meta/data.json index 121fefbd8dea..73557f2cd696 100644 --- a/metricbeat/module/rabbitmq/connection/_meta/data.json +++ b/metricbeat/module/rabbitmq/connection/_meta/data.json @@ -19,7 +19,6 @@ "frame_max": 131072, "host": "::1", "name": "[::1]:60938 -\u003e [::1]:5672", - "node": "nodename", "octet_count": { "received": 3764, "sent": 3840 @@ -34,13 +33,18 @@ "port": 60938 }, "port": 5672, - "type": "network", - "user": "guest", - "vhost": "/" - } + "type": "network" + }, + "node": { + "name": "nodename" + }, + "vhost": "/" }, "service": { - "address": "127.0.0.1:54352", + "address": "127.0.0.1:53939", "type": "rabbitmq" + }, + "user": { + "name": "guest" } } \ No newline at end of file diff --git a/metricbeat/module/rabbitmq/connection/_meta/fields.yml b/metricbeat/module/rabbitmq/connection/_meta/fields.yml index 690c57507f7f..d595cc97928f 100644 --- a/metricbeat/module/rabbitmq/connection/_meta/fields.yml +++ b/metricbeat/module/rabbitmq/connection/_meta/fields.yml @@ -5,19 +5,27 @@ release: ga fields: - name: name - type: keyword + type: alias + path: rabbitmq.name + migration: true description: > The name of the connection with non-ASCII characters escaped as in C. - name: vhost - type: keyword + type: alias + path: rabbitmq.vhost + migration: true description: > Virtual host name with non-ASCII characters escaped as in C. - name: user - type: keyword + type: alias + path: user.name + migration: true description: > User name. - name: node - type: keyword + type: alias + path: rabbitmq.node.name + migration: true description: > Node name. - name: channels diff --git a/metricbeat/module/rabbitmq/connection/connection_test.go b/metricbeat/module/rabbitmq/connection/connection_test.go index 05c2d02ea62d..af5e5ea7d982 100644 --- a/metricbeat/module/rabbitmq/connection/connection_test.go +++ b/metricbeat/module/rabbitmq/connection/connection_test.go @@ -43,9 +43,6 @@ func TestFetchEventContents(t *testing.T) { event := ee.(common.MapStr) assert.EqualValues(t, "[::1]:60938 -> [::1]:5672", event["name"]) - assert.EqualValues(t, "/", event["vhost"]) - assert.EqualValues(t, "guest", event["user"]) - assert.EqualValues(t, "nodename", event["node"]) assert.EqualValues(t, 8, event["channels"]) assert.EqualValues(t, 65535, event["channel_max"]) assert.EqualValues(t, 131072, event["frame_max"]) diff --git a/metricbeat/module/rabbitmq/connection/data.go b/metricbeat/module/rabbitmq/connection/data.go index 9b92872f27e3..be1e56f44863 100644 --- a/metricbeat/module/rabbitmq/connection/data.go +++ b/metricbeat/module/rabbitmq/connection/data.go @@ -22,6 +22,7 @@ import ( "github.com/joeshaw/multierror" + "github.com/elastic/beats/libbeat/common" s "github.com/elastic/beats/libbeat/common/schema" c "github.com/elastic/beats/libbeat/common/schema/mapstriface" "github.com/elastic/beats/libbeat/logp" @@ -80,8 +81,28 @@ func eventsMapping(content []byte, r mb.ReporterV2) { func eventMapping(connection map[string]interface{}, r mb.ReporterV2) error { fields, err := schema.Apply(connection) + + rootFields := common.MapStr{} + if v, err := fields.GetValue("user"); err == nil { + rootFields.Put("user.name", v) + fields.Delete("user") + } + + moduleFields := common.MapStr{} + if v, err := fields.GetValue("vhost"); err == nil { + moduleFields.Put("vhost", v) + fields.Delete("vhost") + } + + if v, err := fields.GetValue("node"); err == nil { + moduleFields.Put("node.name", v) + fields.Delete("node") + } + event := mb.Event{ MetricSetFields: fields, + RootFields: rootFields, + ModuleFields: moduleFields, } r.Event(event) return err diff --git a/metricbeat/module/rabbitmq/exchange/_meta/data.json b/metricbeat/module/rabbitmq/exchange/_meta/data.json index 8c5c1f945741..639a41f5a026 100644 --- a/metricbeat/module/rabbitmq/exchange/_meta/data.json +++ b/metricbeat/module/rabbitmq/exchange/_meta/data.json @@ -33,13 +33,15 @@ } }, "name": "exchange.name", - "type": "fanout", - "user": "guest", - "vhost": "/" - } + "type": "fanout" + }, + "vhost": "/" }, "service": { - "address": "127.0.0.1:55006", + "address": "127.0.0.1:53926", "type": "rabbitmq" + }, + "user": { + "name": "guest" } } \ No newline at end of file diff --git a/metricbeat/module/rabbitmq/exchange/_meta/fields.yml b/metricbeat/module/rabbitmq/exchange/_meta/fields.yml index b706cc75b89b..3d0d9788fc0e 100644 --- a/metricbeat/module/rabbitmq/exchange/_meta/fields.yml +++ b/metricbeat/module/rabbitmq/exchange/_meta/fields.yml @@ -9,7 +9,9 @@ description: > The name of the queue with non-ASCII characters escaped as in C. - name: vhost - type: keyword + type: alias + path: rabbitmq.vhost + migration: true description: > Virtual host name with non-ASCII characters escaped as in C. - name: durable @@ -25,7 +27,9 @@ description: > Whether the exchange is internal, i.e. cannot be directly published to by a client. - name: user - type: keyword + type: alias + path: user.name + migration: true description: > User who created the exchange. diff --git a/metricbeat/module/rabbitmq/exchange/data.go b/metricbeat/module/rabbitmq/exchange/data.go index 9ac3270535ca..7afa0c6e7c3e 100644 --- a/metricbeat/module/rabbitmq/exchange/data.go +++ b/metricbeat/module/rabbitmq/exchange/data.go @@ -22,6 +22,7 @@ import ( "github.com/joeshaw/multierror" + "github.com/elastic/beats/libbeat/common" s "github.com/elastic/beats/libbeat/common/schema" c "github.com/elastic/beats/libbeat/common/schema/mapstriface" "github.com/elastic/beats/libbeat/logp" @@ -84,8 +85,23 @@ func eventMapping(exchange map[string]interface{}, r mb.ReporterV2) error { return err } - event := mb.Event{} - event.MetricSetFields = fields + rootFields := common.MapStr{} + if v, err := fields.GetValue("user"); err == nil { + rootFields.Put("user.name", v) + fields.Delete("user") + } + + moduleFields := common.MapStr{} + if v, err := fields.GetValue("vhost"); err == nil { + moduleFields.Put("vhost", v) + fields.Delete("vhost") + } + + event := mb.Event{ + MetricSetFields: fields, + RootFields: rootFields, + ModuleFields: moduleFields, + } r.Event(event) return nil } diff --git a/metricbeat/module/rabbitmq/exchange/exchange_test.go b/metricbeat/module/rabbitmq/exchange/exchange_test.go index 705edbb821a4..5789f1701be7 100644 --- a/metricbeat/module/rabbitmq/exchange/exchange_test.go +++ b/metricbeat/module/rabbitmq/exchange/exchange_test.go @@ -54,8 +54,6 @@ func TestFetchEventContents(t *testing.T) { } assert.Equal(t, "exchange.name", event["name"]) - assert.Equal(t, "guest", event["user"]) - assert.Equal(t, "/", event["vhost"]) assert.Equal(t, true, event["durable"]) assert.Equal(t, false, event["auto_delete"]) assert.Equal(t, false, event["internal"]) diff --git a/metricbeat/module/rabbitmq/fields.go b/metricbeat/module/rabbitmq/fields.go index 2ec21edff0fe..dc6b1555610d 100644 --- a/metricbeat/module/rabbitmq/fields.go +++ b/metricbeat/module/rabbitmq/fields.go @@ -32,5 +32,5 @@ func init() { // AssetRabbitmq returns asset data. // This is the base64 encoded gzipped contents of ../metricbeat/module/rabbitmq. func AssetRabbitmq() string { - return "eJzsmluP27rxwN/3Uwz8kgTYCPm/7sMfOM1pT/OwQU6T0z4UxWJMjiXWFKlwKHvVot+9GEq+S2s7K21S4PghQNb0zG8uHA4vb2FJzR0EnM9NLL/eAEQTLd3B7C/pT/e/zm4ANLEKporGuzv4/xsAgM3XUHpdW7oBCGQJme4gxxsAphiNy/kO/j5jtrNbmBUxVrN/3AAsDFnNd0nOW3BY0gGBfGJTiaTg66r7Sw/DoaR9aco7R0rGbr/qkzkot/30Sjk0c/M5BtmHkX8PvtigLKlZ+6CPvnsCSD5fCkoSwS8gFrQHCWsTC3Devf3p8/sPH0AVGFBFCgzECivSgAzGwfusl3NVeI7jgf7VhFijBZHaEj+Tr2YK4+H9xhSS4H5lzusRg/bRa3pCmSrQObLcq9B6l39DitTlnIIkyUY4eHeUME/CPJT4OCJPiY+mrMs+LrTWr0lfyrcIWNKIdPcdWUWhNMxmbgnY/CtNMGy1wWvjYN5E4jcQPTjKfTQYu4xW1pCLnB1JXvhQYrxrf9driRCPWBiaqqco9Ptw3Jn+mcKKQhLaVqZ5RONIw8ogBFpRYIKfP36+BR/ARIYPnwC1DsQMZrE/AhZorKRCgDUyaMM4t6T7jaiIQjauJZ9oEjucj0Du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uL+d4v5/nuLSozIN69WkWDXv9MDrePRUIoNbW/IPtc6/+3VcHeUwdAb27KQQRR5khQw+yGwtTn7lG2u1LV7dwrwJUGErATH7F7dWaVvcwj0X8WTw3zPQi0N/yDOld1aztkUGP8v3mzkDPYFxKh5JOwviuEA+uoPThCdPqMZ7ssG0kLu13cYjl+m/UAJG+A0L/lfy0KuBFeOLporXNit8fKi9dl6HdrLGf6MADK3IcCzqO9sEB9zUw3folLPcVOR5ov5sJ/+M+iZooznGclari4FsdmZq8opswOLKNfCjT7sAm6CUCg2v5xTWMpi+zd7GCeJ32dvvUqgcRF1sooIDXVWUawwk0UNGS1bdDrvB7bGEz6VmUGgltgxxDEAr8iWkt8+lmNWVlpidt2AprJ1fygMFccLrofa0oKDKdHh85pA7tpSjOvlTU6UOHPM2zVkW1dK6taG8oHxngdfJYDnVoRzIjUcwpziFPziD30M04QWJaJqpN1OS/YPrqqcEX7o41Ht5fADj5AZXJ1c6Eu7pjH8YjVN7oc/ysYxJ79VSgAMwVyH/er4ZWsATXiEiz5oD2XGPgz9LFtmvkVs1O1Id+pQJXsd6j2aNLctCepvKqEfL4sr0FA8mr8r59rqd/+EThbPk/hDvCsTgi8cDXdWIhUIYHW48ADI7pWP3E9uYLelb0FaZJt7Q5oBqeQslYR1T+eaOInDwjQqNH9pQjFvgspTHbSCOHShlmfcD8nSrO16viSbQvJl0tFUEOkAccIbWXaSQNvW/DYe9vauLSPwnAAD//6TcFvU=" } diff --git a/metricbeat/module/rabbitmq/node/_meta/fields.yml b/metricbeat/module/rabbitmq/node/_meta/fields.yml index 3f3a7be97784..11ab0f698364 100644 --- a/metricbeat/module/rabbitmq/node/_meta/fields.yml +++ b/metricbeat/module/rabbitmq/node/_meta/fields.yml @@ -111,7 +111,9 @@ description: > Number of messages which have been written to the message store. - name: name - type: keyword + type: alias + path: rabbitmq.node.name + migration: true description: > Node name - name: proc.total diff --git a/metricbeat/module/rabbitmq/queue/_meta/data.json b/metricbeat/module/rabbitmq/queue/_meta/data.json index 6e8c85b0a241..8a42940df287 100644 --- a/metricbeat/module/rabbitmq/queue/_meta/data.json +++ b/metricbeat/module/rabbitmq/queue/_meta/data.json @@ -13,6 +13,9 @@ "name": "queue" }, "rabbitmq": { + "node": { + "name": "rabbit@localhost" + }, "queue": { "arguments": { "max_priority": 9 @@ -61,13 +64,12 @@ } }, "name": "queuenamehere", - "node": "rabbit@localhost", - "state": "running", - "vhost": "/" - } + "state": "running" + }, + "vhost": "/" }, "service": { - "address": "127.0.0.1:55326", + "address": "127.0.0.1:53995", "type": "rabbitmq" } } \ No newline at end of file diff --git a/metricbeat/module/rabbitmq/queue/_meta/fields.yml b/metricbeat/module/rabbitmq/queue/_meta/fields.yml index 288efd8e5f9a..82d3790f23e4 100644 --- a/metricbeat/module/rabbitmq/queue/_meta/fields.yml +++ b/metricbeat/module/rabbitmq/queue/_meta/fields.yml @@ -9,7 +9,9 @@ description: > The name of the queue with non-ASCII characters escaped as in C. - name: vhost - type: keyword + type: alias + path: rabbitmq.vhost + migration: true description: > Virtual host name with non-ASCII characters escaped as in C. - name: durable @@ -25,7 +27,9 @@ description: > Whether the queue is exclusive (i.e. has owner_pid). - name: node - type: keyword + type: alias + path: rabbitmq.node.name + migration: true description: > Node name. - name: state diff --git a/metricbeat/module/rabbitmq/queue/data.go b/metricbeat/module/rabbitmq/queue/data.go index 6fd884558a86..be042509fdd9 100644 --- a/metricbeat/module/rabbitmq/queue/data.go +++ b/metricbeat/module/rabbitmq/queue/data.go @@ -24,6 +24,7 @@ import ( "github.com/joeshaw/multierror" + "github.com/elastic/beats/libbeat/common" s "github.com/elastic/beats/libbeat/common/schema" c "github.com/elastic/beats/libbeat/common/schema/mapstriface" "github.com/elastic/beats/libbeat/logp" @@ -112,8 +113,20 @@ func eventMapping(queue map[string]interface{}, r mb.ReporterV2) error { return err } + moduleFields := common.MapStr{} + if v, err := fields.GetValue("vhost"); err == nil { + moduleFields.Put("vhost", v) + fields.Delete("vhost") + } + + if v, err := fields.GetValue("node"); err == nil { + moduleFields.Put("node.name", v) + fields.Delete("node") + } + event := mb.Event{ MetricSetFields: fields, + ModuleFields: moduleFields, } r.Event(event) diff --git a/metricbeat/module/rabbitmq/queue/queue_test.go b/metricbeat/module/rabbitmq/queue/queue_test.go index 9f397ef34fd4..2f3320abbf13 100644 --- a/metricbeat/module/rabbitmq/queue/queue_test.go +++ b/metricbeat/module/rabbitmq/queue/queue_test.go @@ -43,12 +43,10 @@ func TestFetchEventContents(t *testing.T) { event := ee.(common.MapStr) assert.EqualValues(t, "queuenamehere", event["name"]) - assert.EqualValues(t, "/", event["vhost"]) assert.EqualValues(t, true, event["durable"]) assert.EqualValues(t, false, event["auto_delete"]) assert.EqualValues(t, false, event["exclusive"]) assert.EqualValues(t, "running", event["state"]) - assert.EqualValues(t, "rabbit@localhost", event["node"]) arguments := event["arguments"].(common.MapStr) assert.EqualValues(t, 9, arguments["max_priority"])