Log Monitoring
For real time monitoring of application logs, the CEE Ops Center uses the Kubetail utility. The Kubetail utility allows:
-
Tailing multiple pods in a single stream.
-
Tailing all containers within the Pods.
-
Using regular expression to match or find Pod names.
-
Color coding the output of each pod.
To monitor applications logs using the Kubetail utility in the CEE Ops Center, use the following command:
cluster logs kubetail_options
my-pod-v1
my-pod-v1 -c my-container
my-pod-v1 -t int1-context -c my-container
'(service|consumer|thing)' -e regex
-l service=my-service
--selector service=my-service --since 10m
--tail 1
NOTES:
-
cluster logs - Tails a set of pods.
-
kubetail_options - Specifies the following options to tail Kubernetes pods:
-
[-h], --help - Displays the help text.
-
[-c], --container - Specifies the name of the container to tail in the pod. You can use this option multiple times. By default, this option specifies all the containers in the pod.
-
[-n], --namespace - Specifies the Kubernetes namespace where the pods are located.
-
[-t], --context - Specifies the Kubernetes context. For example, int1-contex. It relies on the ~/.kube/config file for the context.
-
[-l], --selector - Specifies the Label selector. You can ignore the pod name if this option is used.
-
[-d], --dry-run - Prints the names of the matched pods and containers.
-
[-p], --previous - Returns the logs for the previous instances of the pods, if the pods are available. Returns either true or false. Default value is false.
-
[-f], --follow - Specifies whether the logs must be streamed. Returns either true or false. Default value is true.
-
[-s], --since - Displays the logs that are newer than a relative duration. For example, 5 seconds, 2 minutes, or 3 hours. Default value is 10 seconds.
-
[-b], --line-buffered - Specify this flag to use a line-buffered. Default value is false.
-
[-e], --regex - Specifies a matching name to use (regex or substring).
-
[-j], --jq - Parse a json output using this option. For example,
--jq ".logger + \" \" + .message"
. -
[-k], --colored-ouput - Displays a colored output. The options include:
-
pod - Display the name of the pod in color.
-
line - Display a entire line in color.
-
false - Displays the output without color.
The default value is false.
-
-
[-z], --skip-colors - Specifies the comma-separated list of colors which is not used in the output. If you have green foreground on black, this option will skips dark grey and green colors. For example,
-z 2,8,10
. Default value is 7,8.-
--timestamps - Displays the timestamps for each log line.
-
--tail - Displays the lines of the recent log files. Default value is -1.
-
-
[-v], --version - Prints the Kubetail utility version.
-
[-r], --cluster - Specifies the name of the Kubeconfig cluster to use.
-
[-i], --show-color-index - Displays the color index before the pod name prefix shown before each log line. Normally only the pod name is added as a prefix before each line, for example
[app-5b7ff6cbcd-bjv8n]
. If this option is selected, then the color index is added as well:[1:app-5b7ff6cbcd-bjv8n]
. This is useful if you have color blindness or if you want to know which colors to exclude (see "--skip-colors"). Default value is false.
-