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

fix: Make agent syslog log level inherit from Nomad agent log #15625

Merged
merged 4 commits into from
Jan 4, 2023

Conversation

dttung2905
Copy link
Contributor

Fix issue : #15087

Hi Nomad Core Dev team,

Below is my attempt to fix the issue mentioned above. Imo, we can either make an extra argument for syslog log level or make it inherit from Nomad Agent existing one. This PR is using the latter approach because there is not need to use the former for a rarely used feature.

Would appreciate getting your feedback on this PR, especially on a few issues:

  • On the mapping between gsyslog and Nomad Agent log, I'm not entirely sure about how OFF and TRACE in Nomad log_level maps to gsyslog log level
  • I attempted to write one similar to TestCommand_Args() but the log is not captured by either ui.ErrorWriter or ui.OutputWriter. Please let me know if a unit test is needed or there are better ways to structure the unit test

Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @dttung2905! I agree that it makes the best sense to have the syslog logger inherit the log level from the agent. I've left a suggestion for how to treat the "OFF" level, but I think what you've done for "TRACE" is fine.

Thanks for the PR!

.changelog/15625.txt Outdated Show resolved Hide resolved
command/agent/command.go Outdated Show resolved Hide resolved
@tgross tgross added theme/config theme/logging backport/1.2.x backport to 1.1.x release line backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line type/bug labels Jan 3, 2023
@tgross tgross moved this from Triaging to In Progress in Nomad - Community Issues Triage Jan 3, 2023
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
@vercel
Copy link

vercel bot commented Jan 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nomad-storybook-and-ui 🔄 Building (Inspect) Jan 4, 2023 at 2:09AM (UTC)

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I found one minor issue around case handling that became obvious once we checked for OFF. Once that's fixed I think this is ready for merge.

command/agent/command.go Show resolved Hide resolved
command/agent/command.go Outdated Show resolved Hide resolved
command/agent/command.go Outdated Show resolved Hide resolved
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@github-actions
Copy link

github-actions bot commented May 5, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.2.x backport to 1.1.x release line backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line theme/config theme/logging type/bug
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants