Hide timestamp from logs #1377

Merged
acid-ant merged 1 commit from a-savchuk/frostfs-node:logger-timestamp into master 2024-10-26 11:30:26 +00:00
Member

Close #1366

Signed-off-by: Aleksey Savchuk a.savchuk@yadro.com

Close #1366 Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
a-savchuk added 3 commits 2024-09-13 13:03:58 +00:00
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
[#1366] ir: Support prepend_timestamp config option, update tests
All checks were successful
DCO action / DCO (pull_request) Successful in 1m43s
Tests and linters / Run gofumpt (pull_request) Successful in 1m36s
Vulncheck / Vulncheck (pull_request) Successful in 3m12s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m32s
Tests and linters / gopls check (pull_request) Successful in 3m57s
Tests and linters / Lint (pull_request) Successful in 4m14s
Tests and linters / Staticcheck (pull_request) Successful in 4m2s
Build / Build Components (pull_request) Successful in 7m43s
Tests and linters / Tests (pull_request) Successful in 11m19s
Tests and linters / Tests with -race (pull_request) Successful in 11m17s
6a9909a383
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
a-savchuk force-pushed logger-timestamp from 6a9909a383 to d89c1b6484 2024-09-13 13:04:18 +00:00 Compare
a-savchuk force-pushed logger-timestamp from d89c1b6484 to 9aeb070f0b 2024-09-13 13:11:45 +00:00 Compare
fyrchik reviewed 2024-09-13 15:10:27 +00:00
@ -41,6 +41,8 @@ func reloadConfig() error {
if err != nil {
return err
}
logPrm.PrependTimestamp = cfg.GetBool("logger.prepend_timestamp")
Owner

just timestamp: true/false

just `timestamp: true/false`
Author
Member

Fixed it

Fixed it
a-savchuk force-pushed logger-timestamp from 9aeb070f0b to 90f32b975c 2024-09-16 07:48:40 +00:00 Compare
Author
Member

Current behavior

Log with timestamp

# the config used:
logger:
    destination: stdout
    timestamp: true
$ journalctl -ru frostfs-storage | head -n 2
сен 16 08:48:03 asavchuk-node1 frostfs-node[1788399]: 2024-09-16T08:48:03.639Z        info        audit/request.go:40        audit event log record        {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/6NGa4DQQQytgPyk2MJAPuPp2aJi3ca1pcaioxQaffTuF", "subject": "030df9d135215610ca5b8e083168a52a0d9cc386ec11a9c44279de14f05c359726", "success": true}
сен 16 08:48:00 asavchuk-node1 frostfs-node[1788399]: 2024-09-16T08:48:00.657Z        info        audit/request.go:40        audit event log record        {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/9LuoCXKTiHmrkQd8nWF84Hdm5cR1hSBoNNJrygM1vzPu", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true}

Log without timestamp

# the config used:
logger:
    destination: stdout
$ journalctl -ru frostfs-storage | head -n 2
сен 16 08:52:03 asavchuk-node1 frostfs-node[1796550]: info        audit/request.go:40        audit event log record        {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/8znY9N8EqZUY7LWDyErt1jQd3NX4mJRkqrCL16hrAWN2", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true}
сен 16 08:52:03 asavchuk-node1 frostfs-node[1796550]: info        audit/request.go:40        audit event log record        {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/HhBu6fPUWzKa6bPhTEdhv2yvvMJjJabYrcgucy41qzwJ", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true}
## Current behavior ### Log with timestamp ```yaml # the config used: logger: destination: stdout timestamp: true ``` ``` $ journalctl -ru frostfs-storage | head -n 2 сен 16 08:48:03 asavchuk-node1 frostfs-node[1788399]: 2024-09-16T08:48:03.639Z info audit/request.go:40 audit event log record {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/6NGa4DQQQytgPyk2MJAPuPp2aJi3ca1pcaioxQaffTuF", "subject": "030df9d135215610ca5b8e083168a52a0d9cc386ec11a9c44279de14f05c359726", "success": true} сен 16 08:48:00 asavchuk-node1 frostfs-node[1788399]: 2024-09-16T08:48:00.657Z info audit/request.go:40 audit event log record {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/9LuoCXKTiHmrkQd8nWF84Hdm5cR1hSBoNNJrygM1vzPu", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true} ``` ### Log without timestamp ```yaml # the config used: logger: destination: stdout ``` ``` $ journalctl -ru frostfs-storage | head -n 2 сен 16 08:52:03 asavchuk-node1 frostfs-node[1796550]: info audit/request.go:40 audit event log record {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/8znY9N8EqZUY7LWDyErt1jQd3NX4mJRkqrCL16hrAWN2", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true} сен 16 08:52:03 asavchuk-node1 frostfs-node[1796550]: info audit/request.go:40 audit event log record {"operation": "/neo.fs.v2.object.ObjectService/Head", "object": "GpcroCgEg7GD5zzDjm32WjWRZrxMtiBPSH7SxGF9XC9q/HhBu6fPUWzKa6bPhTEdhv2yvvMJjJabYrcgucy41qzwJ", "subject": "02902b34cd5d9c78b130dde9d2cfd5681faa69a3b2aafe88cdde8e8e3a584a5162", "success": true} ```
a-savchuk changed title from WIP: Hide timestamp from logs to Hide timestamp from logs 2024-09-16 09:03:11 +00:00
a-savchuk changed title from Hide timestamp from logs to WIP: Hide timestamp from logs 2024-09-16 09:03:16 +00:00
a-savchuk changed title from WIP: Hide timestamp from logs to Hide timestamp from logs 2024-09-16 09:03:20 +00:00
a-savchuk requested review from storage-core-developers 2024-09-16 09:03:28 +00:00
a-savchuk requested review from storage-core-committers 2024-09-16 09:03:29 +00:00
dstepanov-yadro reviewed 2024-09-17 06:38:38 +00:00
@ -41,6 +41,8 @@ func reloadConfig() error {
if err != nil {
return err
}
logPrm.PrependTimestamp = cfg.GetBool("logger.timestamp")

Have you tried to run frostfs-ir after this change?)

Have you tried to run `frostfs-ir` after this change?)

As far as I remember, for frostfs-ir you should define defaults too.

As far as I remember, for `frostfs-ir` you should define defaults too.
Author
Member
  1. Yes, I've tried. It works well because GetBool returns false by default if no config option was found
  2. You're right, I've found the function where we set default config and added default value for logger.timestamp
1. Yes, I've tried. It works well because `GetBool` returns false by default if no config option was found 2. You're right, I've found the function where we set default config and added default value for `logger.timestamp`
a-savchuk force-pushed logger-timestamp from 90f32b975c to 8eff648791 2024-09-17 07:01:17 +00:00 Compare
dstepanov-yadro approved these changes 2024-09-17 07:02:08 +00:00
Dismissed
acid-ant reviewed 2024-09-17 07:45:45 +00:00
@ -121,3 +123,4 @@
c.Sampling.Hook = prm.SamplingHook
}
if !prm.PrependTimestamp {
Member

Why we need ! here, once we have else section?

Why we need `!` here, once we have `else` section?
Author
Member

Fixed it

Fixed it
@ -145,3 +152,4 @@
c.Sampling.Hook = prm.SamplingHook
}
if !prm.PrependTimestamp {
Member

Why we need ! here, once we have else section?

Why we need `!` here, once we have `else` section?
Author
Member

Fixed it

Fixed it
a-savchuk force-pushed logger-timestamp from 8eff648791 to d4bec24c9f 2024-09-17 07:59:05 +00:00 Compare
a-savchuk dismissed dstepanov-yadro's review 2024-09-17 07:59:05 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

dstepanov-yadro approved these changes 2024-09-17 08:00:57 +00:00
acid-ant approved these changes 2024-09-17 08:08:50 +00:00
acid-ant merged commit d4bec24c9f into master 2024-09-17 08:09:15 +00:00
a-savchuk deleted branch logger-timestamp 2024-09-17 08:29:02 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1377
No description provided.