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

Collecting clusterlogging and clusterlogforwarder with inspect (#5) #2257

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 18 additions & 7 deletions must-gather/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ Example must-gather for cluster-logging output:
```
├── cluster-logging
│ ├── clo
│ │ ├── cluster-logging-operator-74dd5994f-6ttgt
│ │ ├── clusterlogforwarder_cr
│ │ ├── cr
│ │ ├── csv
│ │ ├── deployment
│ │ └── logforwarding_cr
│ │ ├── [nampespace_name] ## including openshift-logging
│ │ │ ├── cluster-logging-operator-74dd5994f-6ttgt
│ │ │ ├── cr
│ │ │ ├── csv
│ │ │ └── deployment
│ ├── collector
│ │ ├── fluentd-2tr64
│ ├── eo
Expand Down Expand Up @@ -85,7 +84,7 @@ Example must-gather for cluster-logging output:
├── event-filter.html
├── gather-debug.log
└── namespaces
├── openshift-logging
├── [namespace_name] ## including openshift-logging
│ ├── apps
│ │ ├── daemonsets.yaml
│ │ ├── deployments.yaml
Expand All @@ -94,6 +93,11 @@ Example must-gather for cluster-logging output:
│ ├── batch
│ │ ├── cronjobs.yaml
│ │ └── jobs.yaml
│ ├── logging.openshift.io/
│ │ ├── clusterloggings
│ │ │ ├── instance.yaml
│ │ ├── clusterlogforwarders
│ │ │ └── [clf_name.yaml]
│ ├── core
│ │ ├── configmaps.yaml
│ │ ├── endpoints.yaml
Expand Down Expand Up @@ -176,3 +180,10 @@ Example must-gather for cluster-logging output:
└── openshift-operators-redhat
├── ...
```

### Moved resources
With the support of [multi log forwarder feature](https://docs.openshift.com/container-platform/4.14/logging/log_collection_forwarding/log-forwarding.html#log-forwarding-implementations-multi-clf_log-forwarding) in Openshift Cluster Logging 5.8, CLO resources are moved from `cluster-logging/clo/` to `cluster-logging/clo/[namespace_name]` (to allow multiple instances).

Also, resources like `clusterlogging` and `clusterlogforwarder` are now collected into `namespaces/[namespace_name]/logging.openshift.io/` directories and not in `cluster-logging/clo`. This allows to use tools like [`omc`](https://github.com/gmeghnag/omc/) to work with those resources in a similar way than a live cluster with `oc` commands.

The `deployments`, `daemonsets` and `secrets` can be also found in `namespaces/[namespace_name]/` and can be seen also with [`omc`](https://github.com/gmeghnag/omc/).
7 changes: 6 additions & 1 deletion must-gather/collection-scripts/gather
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ cluster_resources+=(clusterrolebindings)
cluster_resources+=(persistentvolumes)
cluster_resources+=(clusterversion)
cluster_resources+=(machineconfigpool)
cluster_resources+=(customresourcedefinitions)

log "-BEGIN inspecting CRs..." >> "${LOGFILE_PATH}"
for cr in "${cluster_resources[@]}" ; do
Expand All @@ -65,6 +66,8 @@ resources+=(rolebindings)
resources+=(configmaps)
resources+=(serviceaccounts)
resources+=(events)
resources+=(clusterlogging)
resources+=(clusterlogforwarder)

log "BEGIN inspecting namespaces ..." >> "${LOGFILE_PATH}"

Expand All @@ -83,6 +86,8 @@ for namespace in "${cluster_resources[@]}" ; do
done
log "END inspecting namespaces ..." >> "${LOGFILE_PATH}"

log "Data for 'clusterlogging' and 'clusterlogforwarder'" >> "${LOGFILE_PATH}"
echo -e "See https://github.com/openshift/cluster-logging-operator/tree/master/must-gather#moved-resources" > $BASE_COLLECTION_PATH/cluster-logging/clo/clusterlogging_instance.txt

log "BEGIN inspecting install resources ..." >> "${LOGFILE_PATH}"
eo_found="$(oc -n openshift-operators-redhat get deployment elasticsearch-operator --ignore-not-found --no-headers)"
Expand Down Expand Up @@ -121,7 +126,7 @@ if [ "$found_es" != "" ] || [ "$found_lokistack" != "" ] ; then
if [ "$found" != "" ] ; then
KUBECACHEDIR=${BASE_COLLECTION_PATH}/cache-dir ${SCRIPT_DIR}/gather_visualization_resources "$BASE_COLLECTION_PATH" >> "${LOGFILE_PATH}" 2>&1
fi
log "BEGIN gathering CLO resources ..." >> "${LOGFILE_PATH}"
log "END gathering logstorage resources ..." >> "${LOGFILE_PATH}"
else
log "Skipping logstorage inspection. No Elasticsearch deployment found" >> "${LOGFILE_PATH}" 2>&1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ if [ $NAMESPACE == "openshift-logging" ]; then
done
fi

log "Gathering data for 'clusterlogging' and 'clusterlogforwarder' from namespace: $NAMESPACE"
for r in "clusterlogging" "clusterlogforwarder" ; do
names="$(oc -n $NAMESPACE get $r --ignore-not-found -o jsonpath='{.items[*].metadata.name}' | sort -u)"
for name in ${names[@]}; do
data="$(oc -n $NAMESPACE get $r ${name} --ignore-not-found -o yaml)"
if [ "$data" != "" ] ; then
echo $data > "${clo_folder}/${r}_${name}.yaml"
fi
done
done

log "Gathering 'secrets' from logging namespace: $NAMESPACE"
oc -n $NAMESPACE get secrets -o yaml > ${clo_folder}/secrets.yaml 2>&1

Expand Down