-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure ECS compliant logging when enabled. #3829
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
beater/middleware/log_middleware.go
Outdated
}, nil | ||
} | ||
} | ||
|
||
func requestArgs(c *request.Context, ecsEnabled bool) ([]interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of returning []interface
and using Infow
and Errorw
consider to return a logger and add the labels via (*Logger).With
.
If `logging.ecs` is set log data in ECS compliant way. closes elastic#3796
30a0a7e
to
9c0d1f5
Compare
Codecov Report
@@ Coverage Diff @@
## master #3829 +/- ##
=======================================
Coverage 75.16% 75.16%
=======================================
Files 138 138
Lines 6629 6629
=======================================
Hits 4983 4983
Misses 1646 1646 |
💚 CLA has been signed |
cla/check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, just one issue with error.stacktrace
jenkins run the hey-apm tests please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from the timestamp bit. Please merge away after that one is fixed.
Codecov Report
@@ Coverage Diff @@
## master #3829 +/- ##
==========================================
- Coverage 75.95% 75.94% -0.02%
==========================================
Files 161 161
Lines 9787 9789 +2
==========================================
Hits 7434 7434
- Misses 2353 2355 +2
|
If `logging.ecs` is set log data in ECS compliant way. closes elastic#3796
Tested with 7.11.0 BC1, using apm-integration-testing. By default, ECS is enabled. {
"@timestamp": "2020-12-21T06:06:39.084Z",
"ecs.version": "1.6.0",
"error.message": "404 page not found",
"event.duration": 70288,
"http.request.body.bytes": 0,
"http.request.id": "419d573a82ecc524",
"http.request.method": "GET",
"http.response.status_code": 404,
"log.level": "error",
"log.logger": "request",
"log.origin": {
"file.line": 60,
"file.name": "middleware/log_middleware.go"
},
"message": "404 page not found",
"source.address": "172.29.0.1",
"trace.id": "419d573a82ecc5245a96abbede83b173",
"transaction.id": "419d573a82ecc524",
"url.original": "/verloren",
"user_agent.original": "curl/7.68.0"
}
|
Good reminder, we have been meaning to get this into ECS for a long time - elastic/ecs#1208 |
Good call on adding it, thanks! |
Motivation/summary
Move towards ECS compliant logging within the APM Server code by changing the log format and switching
logging.ecs
on by default.Log files created within the libbeat code might still not be ECS compliant.
** Do not merge this PR until we are sure we want to backport to 7.9 **
Checklist
- [ ] I have signed the Contributor License Agreement.I have considered changes for:
- [ ] metrics and monitoring (create issue for Kibana team to add metrics to visualizations, e.g. Kibana#44001)- [ ] telemetry- [ ] Elastic Cloud Enterprise (https://www.elastic.co/products/ece)- [ ] Elastic Cloud on Kubernetes (https://www.elastic.co/elastic-cloud-kubernetes)How to test these changes
Start APM Server and observe log lines. Following changes should be applied by default:
logging.ecs
is enabled, therefore ECS logs MVP fields are addederror
->error.message
stacktrace
->error.stacktrace
url
->url.original
request_id
->http.request.id
method
->http.request.method
content_length
->http.request.body.bytes
remote_address
->source.address
user-agent
->user_agent.original
Related issues
implements #3796