StackState Self-hosted v5.1.x
In a Kubernetes setup, StackState functions are distributed across different pods and logs for each function are stored per pod and container. You can access recent logs using
kubectl, although for long term storage it's recommended to set up log aggregation.
StackState logs are stored per pod and container. The table below shows the pod to access for logs relating to specific StackState functions. Note that actual pod names will include a number or random string suffix (for example,
stackstate-receiver-5b9d79db86-h2hkz) and may also include the release name specified when StackState was deployed as a prefix.
You can access logs on a specific pod using the
$ kubectl logs stackstate-api-0
# Snapshot of logs for all containers of <pod-name>
$ kubectl logs <pod-name> --all-containers=true
# Stream logs for all containers of <pod-name>
$ kubectl logs -f <pod-name> --all-containers=true
# Snapshot of logs for a specific container of <pod-name>
$ kubectl logs -c <container-name> <pod-name>
# Snapshot of logs for previous terminated container of <pod-name>
$ kubectl logs -p -c <container-name> <pod-name>
All synchronization logs can be found in a pod
stackstate-sync-<suffix>. You can use the synchronization name to locate specific log information in a log snapshot.
# Logs of the synchronization for a specific Kubernetes cluster
$ kubectl logs stackstate-sync-0 | grep "Kubernetes - \<cluster-name\>"
# Logs of the Agent synchronization
$ kubectl logs stackstate-sync-0 | grep "Agent"
For long term storage of StackState log data, it's advised that you set up log aggregation on your Kubernetes cluster. This can be done using a third party system for storage such as Elasticsearch, Splunk or Logz.io and a log shipper such as Logstash or Fluentd.
For more details of how this can be done, check: