From 1312bc8f9a41a19cc0190654ffe558f75587d17a Mon Sep 17 00:00:00 2001 From: Jared Watts Date: Tue, 1 Aug 2017 12:10:32 -0700 Subject: [PATCH] docs: add section on collecting all Rook logs --- Documentation/advanced-configuration.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/advanced-configuration.md b/Documentation/advanced-configuration.md index 8a2b69857..6d9997036 100644 --- a/Documentation/advanced-configuration.md +++ b/Documentation/advanced-configuration.md @@ -3,6 +3,7 @@ These examples show how to perform advanced configuration tasks on your Rook storage cluster. +- [Log Collection](#log-collection) - [OSD Information](#osd-information) - [Separate Storage Groups](#separate-storage-groups) - [Configuring Pools](#configuring-pools) @@ -18,6 +19,29 @@ The Kubernetes based examples assume Rook OSD pods are in the `rook` namespace. If you run them in a different namespace, modify `kubectl -n rook [...]` to fit your situation. +## Log Collection + +All Rook logs can be collected in a Kubernetes environment with the following command: +```bash +(for p in $(kubectl -n rook get pods -o jsonpath='{.items[*].metadata.name}') +do + for c in $(kubectl -n rook get pod ${p} -o jsonpath='{.spec.containers[*].name}') + do + echo "BEGIN logs from pod: ${p} ${c}" + kubectl -n rook logs -c ${c} ${p} + echo "END logs from pod: ${p} ${c}" + done +done +for i in $(kubectl -n default get pods -l app=rook-operator -o jsonpath='{.items[*].metadata.name}') +do + echo "BEGIN logs from pod: ${i}" + kubectl -n default logs ${i} + echo "END logs from pod: ${i}" +done) | gzip > /tmp/rook-logs.gz +``` +This gets the logs for every container in every Rook pod and then compresses them into a `.gz` archive +for easy sharing. Note that instead of `gzip`, you could instead pipe to `less` or to a single text file. + ## OSD Information Keeping track of OSDs and their underlying storage devices/directories can be