-
Notifications
You must be signed in to change notification settings - Fork 8
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
Pass log level to executed script for more granular logging possibility #119
Conversation
0bbbba4
to
98787ac
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
==========================================
+ Coverage 65.88% 65.90% +0.02%
==========================================
Files 5 5
Lines 255 264 +9
==========================================
+ Hits 168 174 +6
- Misses 67 68 +1
- Partials 20 22 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Tested with custom script executable agianst stage today, it works as expected:
...
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:123: Writing temporary script to /var/lib/rhc-worker-script
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:128: Processing script ...
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:131: Executing script...
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:83: Successfully set env variable RHC_WORKER_SCRIPT_MODE
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:90: Successfully set env variable LOG_LEVEL to INFO
Apr 03 12:58:35 kvm-02-guest19.rhts.eng.brq.redhat.com rhcd[32119]: 2024/04/03 12:58:35 runner.go:136: Command is being executed with following env variables: [YGG_SOCKET_ADDR=unix:@yggd-dispatcher-lDOHNX PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RHC_WORKER_SCRIPT_MODE=ANALYSIS LOG_LEVEL=INFO]
... |
And just note, that we have this in our code:
So worker and script will be logging everything as info if rhc doesn't share the log level with us. If/When there is possibility to pass custom variables to rhc workers user will be able to overwrite it. If desired we could instead of info level fallback on value in worker config file - would have to be new config option value. |
928ed10
to
652776f
Compare
652776f
to
c839109
Compare
Improve logging format Try to read the script log level from config file, if that fails, use yggdrasil default log level, and if that's not set, use "INFO" as the default one.
c839109
to
b96326d
Compare
HMS-3837
TBD, for future oamg/convert2rhel-insights-tasks#49