script: allow collecting management server and kvm agent logs - #13982
Draft
shwstppr wants to merge 1 commit into
Draft
script: allow collecting management server and kvm agent logs#13982shwstppr wants to merge 1 commit into
shwstppr wants to merge 1 commit into
Conversation
Adds a utility script to collect CloudStack logs for troubleshooting. * Collects management server and KVM agent logs. * Supports collecting logs for a specific date. * Discovers management servers and KVM hosts using CloudMonkey, with database fallback. * Supports limiting collection to specified KVM hosts. * Packages collected logs into a compressed archive. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new troubleshooting utility script to collect Apache CloudStack management server and KVM agent logs, optionally filtered to a specific date and/or a subset of KVM hosts, and packages the results into a tarball.
Changes:
- Introduces
cloudstack-collect-logs.shto detect node type (management vs KVM) and collect the relevant logs. - Implements discovery of management servers and KVM hosts via CloudMonkey (with
jq), with a MySQL/database fallback viadb.properties. - Supports date-scoped extraction across rotated logs and produces a compressed archive with a small
info.txtmanifest.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+23
to
+26
| SSH_USER="${SSH_USER:-root}" | ||
| REQUESTED_HOSTS=() | ||
| SSH_OPTS="${SSH_OPTS:--o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=no}" | ||
|
|
Comment on lines
+333
to
+343
| get_property() { | ||
| local property="$1" | ||
|
|
||
| awk -F= -v property="$property" ' | ||
| $1 == property { | ||
| sub(/^[^=]*=/, "") | ||
| exit | ||
| } | ||
| ' "$DB_PROPERTIES" | ||
| } |
Comment on lines
+367
to
+374
| MYSQL_PWD="$db_password" mysql \ | ||
| --batch \ | ||
| --skip-column-names \ | ||
| -h "$db_host" \ | ||
| -P "$db_port" \ | ||
| -u "$db_user" \ | ||
| "$db_name" \ | ||
| -e "$query" |
Comment on lines
+448
to
+451
| collect_local_log \ | ||
| "$AGENT_LOG_DIR" \ | ||
| "$AGENT_LOG" \ | ||
| "$WORKDIR/kvm/$host_name/$AGENT_LOG" |
Comment on lines
+538
to
+540
| log "Creating archive $ARCHIVE" | ||
| tar -czf "$ARCHIVE" "$WORKDIR" | ||
| rm -rf "$WORKDIR" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13982 +/- ##
============================================
- Coverage 19.74% 19.73% -0.01%
+ Complexity 19960 19957 -3
============================================
Files 6371 6371
Lines 575784 575784
Branches 70478 70478
============================================
- Hits 113665 113635 -30
- Misses 449765 449797 +32
+ Partials 12354 12352 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a utility script to collect CloudStack logs for troubleshooting.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?