Skip to content
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

Change: always use the same timezone in the logs #2194

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

mattmundell
Copy link
Contributor

@mattmundell mattmundell commented May 9, 2024

What

On startup call gvm-libs set_log_tz to specify a single timezone that will be used for all log messages.

Why

Consistent logs are easier to work with.

Example

  1. Turn on some logging in gvmd
--- a/src/gvmd_log_conf.cmake_in
+++ b/src/gvmd_log_conf.cmake_in
@@ -15,7 +15,7 @@ prepend=%t %s %p
 separator=:
 prepend_time_format=%Y-%m-%d %Hh%M.%S %Z
 file=${GVM_LOG_DIR}/gvmd.log
-level=127
+level=128
  1. Set local timezone to UTC.
  2. Start gvmd.
  3. Note that logs are in UTC.
md manage:  DEBUG:2024-05-09 14h19.29 utc:247026: sql_open: polling
  1. In GSA > My Settings set timezone to America/New_York.
  2. Get targets.
$ o m m '<get_targets filter="rows=1 sort=name"/>'
  1. Note that the log messages for the get_targets are in UTC (before this PR these with would be in EDT)
md manage:  DEBUG:2024-05-09 14h19.30 utc:247026:    sql: WITH permissions_subject ... FROM targets ...
  1. Note that the GMP response is correctly still in EDT
<get_targets_response status="200" status_text="OK">
  <target id="76ddbf65-92ee-4f96-bc5d-0db808bffce2">
    ...
    <creation_time>2024-01-08T07:29:07-05:00</creation_time>

References

Closes #1851.

Requires greenbone/gvm-libs/pull/816.

@mattmundell mattmundell requested a review from a team as a code owner May 9, 2024 14:42
Copy link

github-actions bot commented May 9, 2024

Conventional Commits Report

Type Number
Changed 1

🚀 Conventional commits found.

@a-h-abdelsalam a-h-abdelsalam merged commit 5e7f0cc into main Jun 14, 2024
11 checks passed
@a-h-abdelsalam a-h-abdelsalam deleted the consistent-log-tz branch June 14, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inconsistent logs
2 participants