Enable Collection of Logs on Volumes
This section describes how to enable the collection of logs on volumes when creating a workload, service, or job. For more information, see Create a Workload, Create a Stateful or Stateless Service, or Create a Job.
Prerequisites
-
You need to join a project and have the Application Workloads Management permission in the project. For more information, see Project Members and Project Roles.
-
The KubeSphere platform requires the WizTelemetry Logging extension to be installed and enabled, and you must have enabled log collection in the project.
Steps
-
Log in to the KubeSphere web console with a user who has Application Workloads Management permissions and enter your workspace.
-
In the left navigation pane, select Application Workloads > Workloads, Services, or Jobs.
-
On the Workloads page, click Deployments, StatefulSets, or DaemonSets to open the workload list, or on the Jobs page, click Jobs or CronJobs to open the job list.
-
Select a project from the drop-down list in the upper left corner of the page.
-
On the page, click Create.
-
On the Storage Settings tab, click the Collect Logs on Volumes toggle switch to enable the feature.
-
Click Mount Volume to mount a Read-Write mode persistent volume, temporary volume, or persistent volume claim template for the container, and set the Container Log Path.
-
Configure the application in the container to export logs to the container log path under the volume mount directory.
Once log collection is complete, the logs will be printed to the container’s standard output, and you can use the log query tool to search and view the container logs. For more information, see Log Query.