-
Notifications
You must be signed in to change notification settings - Fork 252
CLDSRV-750: add Server Access Logs #5980
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
base: development/9.1
Are you sure you want to change the base?
CLDSRV-750: add Server Access Logs #5980
Conversation
Hello leif-scality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
2e9e717 to
9404507
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 1 file with indirect coverage changes @@ Coverage Diff @@
## development/9.1 #5980 +/- ##
===================================================
+ Coverage 84.10% 84.27% +0.17%
===================================================
Files 193 194 +1
Lines 12335 12422 +87
===================================================
+ Hits 10374 10469 +95
+ Misses 1961 1953 -8
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
00832f8 to
a63c29f
Compare
ed7705b to
b95e090
Compare
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
67a4483 to
9ecbb31
Compare
6c4b7ec to
5cf2562
Compare
|
@nicolas2bert @leif-scality Is this supposed to land in a patch release on 9.1 ? |
lib/Config.js
Outdated
|
|
||
| function parseServerAccessLogs(config) { | ||
| const res = { | ||
| enabled: true, |
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.
Should it be false by default?
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.
Yes, let's set it to false by default so that access.log is not created in Artesca.
config.json
Outdated
| "objectPutRetention": true | ||
| }, | ||
| "serverAccessLogs": { | ||
| "enabled": true, |
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.
Can we also make sure the API relies on this toggle and returns Not Implemented if enabled: false?
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.
done
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
dvasilas
left a comment
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.
(partial review, but I have some comments that can be addressed)
What about tests?
I think we should have tests that verify that what gets written to server-access.log is what is expected, for every API.
It is ok for me to add tests separately in another PR if you prefer, we just need to create the ticket so that we don't forget.
lib/Config.js
Outdated
| function parseServerAccessLogs(config) { | ||
| const res = { | ||
| enabled: true, | ||
| outputFile: './logs/server-access.log', |
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.
| outputFile: './logs/server-access.log', | |
| outputFile: '/logs/server-access.log', |
lib/Config.js
Outdated
|
|
||
| function parseServerAccessLogs(config) { | ||
| const res = { | ||
| enabled: true, |
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.
Yes, let's set it to false by default so that access.log is not created in Artesca.
lib/server.js
Outdated
| res.on('finish', () => { | ||
| // eslint-disable-next-line no-param-reassign | ||
| req.serverAccessLog.endTime = process.hrtime.bigint(); | ||
| logServerAccess(req.serverAccessLog, req, res); |
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.
We log every request, and we end up logging healthcheck requests
{"name":"ServerAccessLogger","time":1762877454094,"action":null,"accountName":null,"accountDisplayName":null,"userName":null,"clientPort":46630,"httpMethod":"GET","bytesDeleted":null,"bytesReceived":0,"bodyLength":0,"contentLength":0,"elapsed_ms":16.621336,"httpURL":"/_/healthcheck/deep","startTime":"14621972622003","requester":null,"operation":"REST.GET.UNKNOWN","requestURI":"GET /_/healthcheck/deep HTTP/1.1","errorCode":null,"objectSize":null,"totalTime":"16","turnAroundTime":null,"referer":null,"userAgent":"Wget/1.24.5","versionID":null,"signatureVersion":null,"cipherSuite":null,"authenticationType":null,"hostHeader":"10.160.105.56","tlsVersion":null,"aclRequired":null,"bucketOwner":null,"bucketName":null,"req_id":"7e243b2d294f92a03ca9","bytesSent":null,"clientIP":"::ffff:127.0.0.1","httpCode":200,"objectKey":null,"logFormatVersion":"0","loggingEnabled":false,"loggingTargetBucket":null,"loggingTargetPrefix":null,"awsAccessKeyID":null,"raftSessionID":null,"level":"info","message":"SERVER_ACCESS_LOG","hostname":"dvasilas-L01-store-1","pid":89}
One idea to avoid that could be not to write to access log at all for internal routes, using the url to detect them:
if (!req.url.startsWith('/_/')) {
res.on('finish', () => {
...
}
That way we wil also filter out requests to the backbeat routes.
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.
done
| "objectPutRetention": true | ||
| }, | ||
| "serverAccessLogs": { | ||
| "enabled": false, |
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.
Could we have two types of "enabled"?
- "Are we writing the
server-access.log" (defaultfalsefor Artesca). We could call this field"generateAcessLogFile" - "Is the feature enabled in Federation" (
falseby default, will be configured by Federation). When this isfalse: (1) The API returnsnot implemented, and (2) Cloudserver always setsloggingEnabledtofalse. That way, we can disable the feature in Federation.
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.
In what case we would generate the file and not write to it?
can the config file be modified in Federation?
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.
In what case we would generate the file and not write to it?
For Artesca we should not generate it and not write to it
can the config file be modified in Federation?
Yes, the config.json in this repo is not actually used in Federation.
Federation has a template to generate its own: https://github.com/scality/Federation/blob/development/9.5/roles/run-s3/templates/config.json.j2
( so when bumping cloudserver, we should also update this template)
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.
For Artesca we should not generate it and not write to it
This is already the case when enabled = false
4f7ce85 to
85d7ab9
Compare
81eb964 to
940992a
Compare
No description provided.