Cowboy is a tool for processing Rancher CI log dump archives collected during cluster failures. It extracts, parses, and organizes diagnostic data from Rancher-managed Kubernetes clusters into a structured ZIP archive.
Available as:
- πΉ CLI tool - Standalone binary for local use
- π³ Container image -
ghcr.io/rancherlabs/cowboy:latest - β‘ GitHub Action - Seamless CI/CD integration
When Rancher CI encounters cluster failures, it generates log dumps containing base64-encoded gzip-compressed blobs of Kubernetes cluster resources, pod logs, and other diagnostic information. Cowboy:
- Extracts - Finds and decodes base64+gzip compressed blobs from log dump files
- Parses - Deserializes structured JSON data into typed Kubernetes resources
- Organizes - Writes resources as individual YAML files in a navigable directory structure
- Archives - Bundles everything into a ZIP file for easy distribution and analysis
Add this to your workflow to automatically process log dumps:
name: Process Log Dump
on: [push]
jobs:
process:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Process Rancher log dump
uses: rancherlabs/cowboy@v1
with:
log-file-path: ./logs/failure-dump.txt
output-file: diagnostic-bundle.zipThe processed ZIP file is automatically uploaded as a workflow artifact and can be downloaded from the Actions tab.
# Process from stdin
cat logdump.txt | docker run -i ghcr.io/rancherlabs/cowboy:latest
# Process from file (with volume mount)
docker run --rm -v $(pwd):/workspace -w /workspace \
ghcr.io/rancherlabs/cowboy:latest \
-output results.zip < logdump.txtgo build -o cowboy main.goOr install globally:
go install .Cowboy supports two input methods:
cowboy -url "https://example.com/logdump.txt" -output failure_logs.zipcat logdump.txt | cowboy -output extracted.zip
cowboy < logdump.txt -output extracted.zip| Flag | Default | Description |
|---|---|---|
-url |
(none) | URL to fetch log dump from |
-output |
log_dump.zip |
Output ZIP file path |
The generated ZIP archive contains the following structure:
output.zip
βββ blob_1/
β βββ capi_cluster.yaml # Cluster API cluster resource
β βββ cluster.yaml # Rancher provisioning cluster
β βββ infra_cluster.yaml # RKE cluster resource
β βββ rke_controlplane.yaml # RKE control plane configuration
β βββ mgmt_cluster.yaml # Rancher management cluster
β βββ full_decoded_raw_dump.json # Raw JSON for debugging
β βββ machines/
β β βββ machine_<name>.yaml # CAPI machine resources
β βββ machine_sets/
β β βββ machineset_<name>.yaml # CAPI machine set resources
β βββ machine_deployments/
β β βββ machinedeployment_<name>.yaml
β βββ infra_machines/
β β βββ infra_machine_<name>.yaml
β βββ rke_bootstraps/
β β βββ rke_bootstrap_<name>.yaml
β βββ etcd_snapshots/
β β βββ snapshot_<name>.yaml
β βββ pod_logs/
β βββ <node_name>/
β βββ <pod_log_key>.txt # Decoded pod logs
βββ blob_2/
β βββ ...
βββ rancher_logs/
βββ rancher_log_1.txt # Non-JSON log content
βββ ...
| Type | Description |
|---|---|
CapiCluster |
Cluster API (CAPI) infrastructure-agnostic cluster definition |
Cluster |
Rancher provisioning cluster lifecycle and configuration |
InfraCluster |
RKE (Rancher Kubernetes Engine) infrastructure-specific configuration |
Machines |
CAPI machine resources for control plane and worker nodes |
MachineSets |
CAPI machine set definitions for declarative machine control |
MachineDeployments |
CAPI machine deployment resources |
InfraMachines |
Infrastructure machine objects defining cluster nodes |
RKEControlPlane |
RKE control plane resource configuration |
RKEBootstrap |
RKE bootstrap resources for node bootstrapping |
ETCDSnapshots |
etcd snapshot resources for backup/recovery |
PodLogs |
Container logs organized by node and pod |
go test -v ./...Tests validate:
- Blob extraction from compressed input
- Base64+gzip decoding functionality
- JSON/YAML parsing of Rancher resources
- ZIP archive creation with correct structure
Cowboy uses the following key dependencies:
- Rancher Kubernetes APIs - Management, Provisioning, and RKE API types
- Cluster API - Infrastructure-agnostic cluster management
- siggy YAML - YAML marshaling for Go structs
| Input | Required | Default | Description |
|---|---|---|---|
log-file-path |
Yes | - | Path to the Rancher log dump file to process |
output-file |
No | <input-basename>_dump.zip |
Output ZIP file name |
upload-artifact |
No | true |
Upload the generated ZIP as a GitHub Actions artifact |
artifact-retention-days |
No | 30 |
Number of days to retain the artifact (1-90) |
| Output | Description |
|---|---|
output-path |
Path to the generated ZIP file |
artifact-name |
Name of the uploaded artifact (if upload-artifact is true) |
- uses: rancherlabs/cowboy@v1
with:
log-file-path: ./logdump.txt- uses: rancherlabs/cowboy@v1
with:
log-file-path: ./logs/cluster-failure.txt
output-file: cluster-diagnostics.zip
upload-artifact: 'false'- uses: rancherlabs/cowboy@v1
with:
log-file-path: ./dumps/production-failure.txt
output-file: prod-diagnostics.zip
artifact-retention-days: '90'- name: Process log dump
id: cowboy
uses: rancherlabs/cowboy@v1
with:
log-file-path: ./logdump.txt
- name: Upload to S3
run: |
aws s3 cp ${{ steps.cowboy.outputs.output-path }} s3://my-bucket/diagnostics/The container image is available at ghcr.io/rancherlabs/cowboy with the following tags:
latest- Latest build from the main branchv1,v1.0,v1.0.0- Semantic version tagsmain,master- Branch-based tagsmain-abc1234- Git SHA tags for specific commits