Kubernetes
To collect logs from Kubernetes containers and the applications in Kubernetes containers, check the following.
Agent Update
It is available from Kubernetes agent 1.1.35. For more information about update, see the following.
Checking the agent settings
Home > Select Project > Log > Log Setting
Select a project in the initial screen of the WhaTap monitoring service, and then select Log > Log Setting under Project Menu. Proceed with the process according to the instructions in the Check Agent CONF. tab of the Set up the agent and enable log monitoring section.
Enabling the container log collection
To collect logs in Kubernetes containers, select Apply log settings in the Check agent configuration tab.
Enabling application log collection in the container
It is available from Java 2.1.1 and Python 1.2.2. To collect logs of the applications running on Kubernetes containers, see the following.
-
On the lower part of Check agent settings, select Agent CONFIG..
-
Go to Application Agent CONFIG., and then select Direct Input in the Write Options window.
-
Enter the key,
logsink_enabled
and the value,true
of the following agent configuration command in the field.logsink_enabled=true
-
Select Apply. You can collect application logs in the Kubernetes containers.
-
For more information about the collection of Java application logs, see the following.
-
For more information about the collection of Python application logs, see the following.
-
For more information about the collection of Go application logs, see the following.
Enabling the log monitoring
Home > Select Project > Log > Log Setting
You can enable or disable the WhaTap log monitoring with the toggle button in the Activate log monitoring tab of the Starting the log monitoring section.
- If you turn on , the log monitoring is enabled. You can try for free for 15 days from the activation date.
- If you turn off , the log monitoring is disabled. Logs are no longer saved.
Role
After agent installation, you can enable the log monitoring settings only when you have the edit permission on the project. For more information about the roles, see the following.
Kubernetes log monitoring category guide
You can check various logs related to Kubernetes. The monitoring categories provided by WhaTap Kubernetes are as follows. Depending on the settings, duplicate log contents may be stored. Be sure to check for duplicates.
Category | Description |
---|---|
#K8sEvent |
|
#WhatapEvent |
|
containerStdout |
|
AppLog |
|
Setting the containerStdOut log filter
Home > Select Project > Management > Agent CONF.
The following guides you to filtering options to select information needed in the Kubernetes logs. You can set which logs to allow or exclude through filtering. In Agent CONF., select Direct Input in the Write options manner.
Log naming conventions
The Kubernetes containerStdOut logs are generated under the /var/log/containers/ path on the node. They keep the following naming conventions.
<podName>_<namespace>_<containerName>-<containerId>.log
Log filtering options
-
log_filter_enabled bool
Default
false
It sets whether to use log filters.
-
log_fillter_allow_list list
It sets the list of logs to allow. It indicates the items to be included for filtering.
-
log_fillter_deny_list list
It sets the list of logs to exclude. It indicates the items to be excluded for filtering.
Log filtering operation
Log filters work only when the log_filter_enabled
option is active. You can selectively collect logs via log_fillter_allow_list
and log_fillter_deny_list
when the value of the option is set to true
.
Log filters work on a blacklist basis. For example, if you enable log_filter_enabled
and do not set any items to add to the log_filter_allow_list
option, log collection for all containers is blocked by default.
Additionally, in the log filters, deny rules take precedence over allow rules. If the same items are set in both allow and deny rules, the deny rule takes precedence and logs are not collected.
Log filter example
Collecting logs for a single namespace
- Allow log_filter_allow_list
*_infra_*
All containers that exist in the infra
namespace are targeted for collection.
Collecting multiple namespace logs
- Allow log_filter_allow_list
*_infra_*, *_monitoring_*
All containers that exist in the infra
and monitoring
namespaces are specified as collection targets.
Pods containing specific terms are excluded.
-
Allow log_filter_allow_list
*_*_*
-
Deny log_filter_deny_list
*prod*_*_*
All containers are targeted for collection, but the logs that contain prod
in podName
are excluded.
Pods containing specific terms are collected.
- Allow log_filter_allow_list
*prod*_*_*
Only the logs that contain prod
in podName
are collected.
Multi-namespace logs are collected and Pods containing specific terms are excluded.
-
Allow log_filter_allow_list
*_infra_*, *_monitoring_*
-
Deny log_filter_deny_list
*prod*_*_*
The logs for the infra
and monitoring
namespaces are collected, and the logs that contain prod
in podName
are excluded.
The container logs that start with a specific term in the container name are excluded.
- Allow log_filter_allow_list
*_*_db-*
The container logs whose containerName
starts with db
in all namespaces are excluded.