The oc adm must-gather
tool is essential for troubleshooting and diagnostics in OpenShift. With the release of OpenShift 4.17, new flags have been introduced to enhance flexibility and precision in data collection. These additions enable administrators to gather logs more efficiently while reducing unnecessary data collection.
New Flags in Must-Gather
--since
This flag allows users to collect logs newer than a specified duration. For example:
oc adm must-gather --since=24h
This command gathers logs from the past 24 hours, making it easier to pinpoint recent issues.
--since-time
The --since-time
flag lets users specify an exact timestamp (RFC3339 format) to collect logs from a particular point in time.
oc adm must-gather --since-time=2025-02-10T11:12:39Z
This is useful for investigating incidents that occurred at a specific time.
Existing Flags for Enhanced Customization
Along with the new additions, several existing flags provide more control over the data collection process:
--all-images
: Uses the default image for all operators annotated withoperators.openshift.io/must-gather-image
.--dest-dir
: Specifies a local directory to store gathered data.--host-network
: Runs must-gather pods withhostNetwork: true
for capturing host-level data.--image
: Allows specifying a must-gather plugin image to run.--node-name
: Targets a specific node for data collection.--node-selector
: Selects nodes based on a node selector.--run-namespace
: Runs must-gather pods within an existing privileged namespace.--source-dir
: Defines the directory from which data is copied.--timeout
: Sets a time limit for data gathering.--volume-percentage
: Adjusts the maximum storage percentage for gathered data.
Conclusion
The introduction of --since
and --since-time
in OpenShift 4.17 significantly improves must-gather’s efficiency by enabling targeted log collection. By leveraging these and other available flags, administrators can streamline troubleshooting and optimize diagnostics.
For a deeper dive into must-gather and its latest enhancements, check out the official OpenShift documentation.