Skip to content

Commit

Permalink
update ecs-migratoin, fields yml, changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Jan 29, 2019
1 parent e4ae0a3 commit abdd1a6
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Removed Prometheus stats metricset in favor of just using Prometheus collector {pull}9948[9948]
- Adjust Redis.info metricset fields to ECS. {pull}10319[10319]
- Rename http.request.body field to http.request.body.content. {pull}10315[10315]
- Adjust php_fpm.process metricset fields to ECS. {pull}10366[10366]

*Packetbeat*

Expand Down
37 changes: 37 additions & 0 deletions dev-tools/ecs-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,43 @@

### Redis

- from: php_fpm.status.pid
to: process.pid
alias: true
beat: metricbeat

- from: php_fpm.status.request_duration
to: event.duration
alias: true
beat: metricbeat

- from: php_fpm.status.request_duration
to: event.duration
alias: true
beat: metricbeat

- from: php_fpm.status.request_method
to: http.request.method
alias: true
beat: metricbeat

- from: php_fpm.status.request_uri
to: url.original
alias: true
beat: metricbeat

- from: php_fpm.status.content_length
to: http.response.body.bytes
alias: true
beat: metricbeat

- from: php_fpm.status.user
to: http.response.user.name
alias: true
beat: metricbeat

### Redis

- from: redis.info.server.version
to: service.version
alias: true
Expand Down
24 changes: 18 additions & 6 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18851,7 +18851,9 @@ process contains the metrics that were obtained from the PHP-FPM process.
*`php_fpm.process.pid`*::
+
--
type: integer
type: alias
alias to: process.pid
The PID of the process
Expand Down Expand Up @@ -18903,7 +18905,9 @@ The number of requests the process has served
*`php_fpm.process.request_duration`*::
+
--
type: integer
type: alias
alias to: event.duration
The duration in microseconds (1 million in a second) of the current request (my own definition)
Expand All @@ -18913,7 +18917,9 @@ The duration in microseconds (1 million in a second) of the current request (my
*`php_fpm.process.request_method`*::
+
--
type: keyword
type: alias
alias to: http.request.method
The request method (GET, POST, etc) (of the current request)
Expand All @@ -18923,7 +18929,9 @@ The request method (GET, POST, etc) (of the current request)
*`php_fpm.process.request_uri`*::
+
--
type: text
type: alias
alias to: url.original
The request URI with the query string (of the current request)
Expand All @@ -18933,7 +18941,9 @@ The request URI with the query string (of the current request)
*`php_fpm.process.content_length`*::
+
--
type: integer
type: alias
alias to: http.response.body.bytes
The content length of the request (only with POST) (of the current request)
Expand All @@ -18943,7 +18953,9 @@ The content length of the request (only with POST) (of the current request)
*`php_fpm.process.user`*::
+
--
type: keyword
type: alias
alias to: user.name
The user (PHP_AUTH_USER) (or - if not set) (for the current request)
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/php_fpm/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions metricbeat/module/php_fpm/pool/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"total": 2
},
"slow_requests": 0,
"start_since": 491,
"start_time": 1548678234
"start_since": 600,
"start_time": 1548749474
}
},
"service": {
Expand Down
7 changes: 3 additions & 4 deletions metricbeat/module/php_fpm/process/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"http": {
"request": {
"method": "GET"
"method": "get"
},
"response": {
"body": {
Expand All @@ -29,11 +29,10 @@
"process": {
"last_request_cpu": 0,
"last_request_memory": 0,
"request_duration": 231,
"requests": 6,
"script": "-",
"start_since": 492,
"start_time": 1548678234,
"start_since": 600,
"start_time": 1548749474,
"state": "Running"
}
},
Expand Down
24 changes: 18 additions & 6 deletions metricbeat/module/php_fpm/process/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
release: ga
fields:
- name: pid
type: integer
type: alias
path: process.pid
migration: true
description: >
The PID of the process
- name: state
Expand All @@ -26,23 +28,33 @@
description: >
The number of requests the process has served
- name: request_duration
type: integer
type: alias
path: event.duration
migration: true
description: >
The duration in microseconds (1 million in a second) of the current request (my own definition)
- name: request_method
type: keyword
type: alias
path: http.request.method
migration: true
description: >
The request method (GET, POST, etc) (of the current request)
- name: request_uri
type: text
type: alias
path: url.original
migration: true
description: >
The request URI with the query string (of the current request)
- name: content_length
type: integer
type: alias
path: http.response.body.bytes
migration: true
description: >
The content length of the request (only with POST) (of the current request)
- name: user
type: keyword
type: alias
path: user.name
migration: true
description: >
The user (PHP_AUTH_USER) (or - if not set) (for the current request)
- name: script
Expand Down
7 changes: 5 additions & 2 deletions metricbeat/module/php_fpm/process/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package process

import (
"encoding/json"
"strings"

"github.com/elastic/beats/metricbeat/mb"

Expand Down Expand Up @@ -59,7 +60,7 @@ func eventsMapping(r mb.ReporterV2, content []byte) {
RootFields: common.MapStr{
"http": common.MapStr{
"request": common.MapStr{
"method": process.RequestMethod,
"method": strings.ToLower(process.RequestMethod),
},
"response": common.MapStr{
"body": common.MapStr{
Expand All @@ -76,13 +77,15 @@ func eventsMapping(r mb.ReporterV2, content []byte) {
"url": common.MapStr{
"original": process.RequestURI,
},
"event": common.MapStr{
"duration": process.RequestDuration * 1000,
},
},
MetricSetFields: common.MapStr{
"state": process.State,
"start_time": process.StartTime,
"start_since": process.StartSince,
"requests": process.Requests,
"request_duration": process.RequestDuration,
"script": process.Script,
"last_request_cpu": process.LastRequestCPU,
"last_request_memory": process.LastRequestMemory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestFetch(t *testing.T) {
}

t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(),
events[0].BeatEvent("haproxy", "info").Fields.StringToPrint())
events[0].BeatEvent("php_fpm", "process").Fields.StringToPrint())

}

Expand Down

0 comments on commit abdd1a6

Please sign in to comment.