Search…
TVK Log Collector
This page describes how to setup the TVK log collector and collect logs for support analysis
tvk-log-collector collects the logs, config and events of resources. Pod Logs can help you understand what is happening inside your application. The logs are particularly useful for debugging problems and monitoring cluster activity, alongside the metadata of all resources related to TrilioVault as either namespaced by providing namespaces name separated by comma or clustered from k8s cluster for debugging k8s-triliovault application. It also collects the CRDs yaml related to TVK and zip them.

Pre-requisites:

  1. 1.
    krew - kubectl-plugin manager. Install from here
  2. 2.
    kubectl - kubernetes command-line tool. Install from here

Supported OS and Architectures:

  • linux/amd64
  • linux/x86
  • linux/arm
  • linux/arm64
  • darwin/amd64
  • darwin/arm64
  • windows/amd64

Installation, Upgrade, Removal of Plugins :

With krew:

  • Add TVK custom plugin index of krew:
    1
    kubectl krew index add tvk-plugins https://github.com/trilioData/tvk-plugins.git
    Copied!
  • Installation:
    1
    kubectl krew install tvk-plugins/tvk-log-collector
    Copied!
  • Upgrade:
    1
    kubectl krew upgrade tvk-log-collector
    Copied!
  • Removal:
    1
    kubectl krew uninstall tvk-log-collector
    Copied!

Without krew:

  1. 2.
    Choose a version of log-collector plugin to install and check if release assets have log-collector plugin's package [log-collector_${version}${OS}${ARCH}.tar.gz] for your desired OS & Architecture.
    • To check OS & Architecture, execute command uname -a on linux/macOS and systeminfo on windows
  2. 3.
    Set env variable version=v1.x.x [update with your desired version]. If version is not exported, latest tagged version will be considered.

Linux/macOS

  • Bash or ZSH shells
1
(
2
set -ex; cd "$(mktemp -d)" &&
3
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
4
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
5
if [[ -z ${version} ]]; then version=$(curl -s https://api.github.com/repos/trilioData/tvk-plugins/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'); fi &&
6
echo "Installing version=${version}" &&
7
package_name="log-collector_${version}_${OS}_${ARCH}.tar.gz" &&
8
curl -fsSLO "https://github.com/trilioData/tvk-plugins/releases/download/"${version}"/${package_name}" &&
9
tar zxvf ${package_name} && sudo mv log-collector /usr/local/bin/kubectl-tvk_log_collector
10
)
Copied!
Verify installation with kubectl tvk-log-collector --help
Windows
  1. 1.
    Download log-collector_${version}_windows_${ARCH}.zip from the Releases page to a directory and unzip the package.
  2. 2.
    Launch a command prompt (log-collector.exe).

Usage:

1
kubectl tvk-log-collector [flags]
Copied!

Flags:

Parameter
Default
Description
--clustered
false
whether clustered installation of trilio application
--namespaces
[]
list of namespaces to look for resources separated by commas
--kubeconfig
~/.kube/config
path to the kubernetes config
--keep-source-folder
false
Keep source directory and Zip both
--log-level
INFO
log level for debugging ( INFO ERROR DEBUG WARNING DEBUG )
--config-file
path to config file for log collector inputs
--gvk
json string to give list of GVKs that want be collected other than log collector handles
--label-selector
json string to give list of all label selector for resources to be collected other than log collector collects

Examples

  • To collect logs & YAML from multiple namespaces (separated by commas in double quotes):
    1
    kubectl tvk-log-collector --namespaces "<ns1>,<ns2>" --log-level info
    Copied!
  • To collect logs & YAML from all over the cluster:
    1
    kubectl tvk-log-collector --clustered --log-level info
    Copied!
  • To collect logs with log level error and to keep the folder with & without zip:
    1
    kubectl tvk-log-collector --clustered --keep-source-folder --log-level error
    Copied!
  • To collect logs by providing object gvk which log collector doesn't collect by default :
    1
    kubectl tvk-log-collector --clustered --gvks "/v1/pod","apps//Deployment"
    Copied!
  • To collect object logs by providing labels which log collector doesn't collect by default :
    1
    kubectl tvk-log-collector --clustered --labels "app=frontend,custom=label","app=backend"
    Copied!
  • To collect logs by providing config file :
    1
    kubectl tvk-log-collector --config-file <path/to/config/file.yaml>
    Copied!
The format of data in a file should be according to the below example:
1
keep-source-folder: true
2
clustered: false
3
namespaces:
4
- default
5
- tvk
6
logLevel: INFO
7
kubeConfig: path/to/config
8
labels:
9
- matchLabels:
10
"app": "frontend"
11
"custom": "label"
12
- matchLabels:
13
"app": "backend"
14
gvks:
15
- group: ""
16
version: ""
17
kind: pod
18
- group: apps
19
version: ""
20
kind: Deployment
21
Copied!
Run a log collector with predefined values using a sample file. Download the file using below commands:
By wget
1
wget https://github.com/trilioData/tvk-plugins/tree/main/docs/log-collector/sample_input.yaml
Copied!
By curl
1
curl https://github.com/trilioData/tvk-plugins/tree/main/docs/log-collector/sample_input.yaml
Copied!

Output

This command will create triliovault-<date-time>.zip zip file containing cluster debugging information.

Resources Considered for Log Collection:

1
CustomResourceDefinition
2
VolumeSnapshots
3
VolumeSnapshotClass
4
StorageClass
5
Jobs
6
Pods
7
DaemonSets
8
Deployments
9
ReplicaSets
10
StatefulSet
11
PersistentVolumeClaims
12
PersistentVolumes
13
Services
14
ServiceAccounts
15
Endpoints
16
Ingress
17
Events
18
ConfigMap
19
LimitRange
20
ResourceQuota
21
Role
22
RoleBinding
23
Namespaces
24
Nodes
Copied!
When clustered flag enabled:
1
ClusterRole
2
ClusterRoleBinding
3
MutatingWebhookConfiguration
4
ValidatingWebhookConfiguration
5
PersistentVolume
6
IngressClass
Copied!
and TrilioVault Resources

OCP Specific Resources Considered for Log Collection:

1
ClusterServiceVersion
2
CatalogSource
3
InstallPlan
4
OperatorCondition
5
Route
6
Subscription
Copied!