LogoLogo
Cocktail Cloud
  • What is Cocktail Cloud?
  • Apply for Service
    • Using Cocktail Cloud
  • overview
    • Kubernetes and Cocktail Cloud
    • Understanding Concepts
      • Platform
      • Workspace
      • Cluster
      • Service Map
      • Image Build
      • Security
      • Monitoring
      • Catalog
  • Getting Started
    • Cluster Creation
      • AWS (EKS)
      • NCP (NKS)
      • Azure (AKS)
      • GCP (GKE)
      • ETC (Datacenter)
    • Cluster Registration
      • AWS (EKS)
      • NCP (NKS)
      • Azure (AKS)
      • GCP (GKE)
      • ETC (Datacenter)
    • Managing Cloud Provider
      • AWS
    • Creating a User
    • Create Service Map
    • Create Registry
      • Create Registry
      • External Registry Registration
        • Setting Up AWS ECR
        • Setting Up Azure ACR
        • Setting Up Docker Hub
        • Setting Up Docker Registry
        • Setting Up Google GCR
        • Setting Up Harbor
        • Setting Up Naver
        • Setting Up Quay
    • Create a Workspace
  • Cluster Backup and Restore
    • Cocktail Backup and Restore
    • Backup/Restore Preparations
      • AWS S3 Configuration
      • Azure Blob Storage Configuration
      • Google Cloud Storage Configuration
      • MinIO Configuration
    • Create storages
    • Backups
    • Restoration
    • Backup/Restore Overview
  • Log Service
    • Cocktail Log Service
    • Installation
      • Install Log Service
      • Registration Log Service
      • Install Log Agent
      • Install Log Operator
    • Setting
      • Change Opensearch Admin password
    • Application Logs
      • Application Management
      • Application logging
        • Automatic instrumentation of container logs
          • Java
          • Python
        • Manual measurement of file logs(SDK)
          • Java
          • Python
        • Manual measurement of file logs (Sidecar)
          • Fluent-bit
    • Container Logs
    • Cluster Audit Logs
    • Troubleshooting
  • CI/CD
    • Creating a Build Server
    • Build Image
    • Setting up a Pipeline
  • application
    • Catalog
    • Application Deployment
    • Configuration Information Creation
    • Volume Requests
    • Service Exposure
    • Ingress
    • Service Mesh Configuration
  • Platform Management
    • Multicluster Configuration
    • Cluster Management
    • Workspace Management
    • Security
    • Integrated Monitoring
  • API Management
    • API Token Issuance
    • API Issuance History
    • API Execution Logs
  • Certificate Management
    • Issuer Management
    • Private Certificate
    • Public Certificate
  • Deepening operations
    • Maintaining Login Session in Case of Inability with Ingress Configuration
    • Add Ingress Proxy Configuration
    • Accessing Harbor from a Server Other Than the Registry VM
    • Configuring Harbor with a Public SSL Certificate
Powered by GitBook

â“’2023. Acornsoft Corp. All rights reserved.

On this page
  • 1) CRD installation
  • 2) Add annotations to the applications you want to collect
  • 3) Add service name and token value to environment variables.
  • 4. Check Application log
  • 1) Logging - Application Log - Search for the application you set in the application list.

Was this helpful?

Export as PDF
  1. Log Service
  2. Application Logs
  3. Application logging
  4. Automatic instrumentation of container logs

Python

PreviousJavaNextManual measurement of file logs(SDK)

Last updated 1 year ago

Was this helpful?

1) CRD installation

You can create one by searching for Infrastructure - Custom Resources - 'instrumentations'.

You can create it by clicking the Create button, selecting the namespace where you want to collect logs, and modifying the form below.

The above CRD is applied on a namespace basis, and automatic container logs can be collected for other languages ​​in the same namespace.

apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: {Instrumentation name}
spec:
  exporter:
    endpoint: {log-agent Service address}:4318
  python:
    image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.44b0
    env:
      - name: OTEL_LOGS_EXPORTER
        value: otlp_proto_http
      - name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
        value: {log-agent Service address}:4318/v1/logs
      - name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED
        value: 'true'
        
      # Used when you want to collect all Java applications for which the anotation value of the namespace is 'true'.
      - name: OTEL_EXPORTER_OTLP_LOGS_HEADERS
        value: app_token={Application Token},app_name={Application Name}

log-agent Service Address : Infrastructure - Cluster - Add-ons - Click 'log-agent' and check the service name.

( http port = 4318 , grpc port = 4317)

2) Add annotations to the applications you want to collect

Add annotations to the workloads in the namespace for which you want to collect logs.

Application - Service Map - Service Map to collect logs - Workload - Select the application to collect logs - Click the "Settings" button.

Change the Yaml view and add the following annotations to the template - metadata - annotations section.

instrumentation.opentelemetry.io/inject-python: 'true'

3) Add service name and token value to environment variables.

apiVersion: apps/v1
kind: Deployment
...
spec:
...
  template:
    spec:
      containers:
      - env:

	# Application name
	- name: OTEL_SERVICE_NAME
          value: {Application name}
        
        # Settings for authentication
        - name: OTEL_EXPORTER_OTLP_LOGS_HEADERS
          value: app_token={Application token},app_name={application name}     
        
        image: {python-application image}
        imagePullPolicy: Always
        ...

4. Check Application log

1) Logging - Application Log - Search for the application you set in the application list.