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. Image creation via SDK
  • 1) Build/Pipeline - Build details of the Python application for which you want to collect logs from the build.
  • 2) Click on the image build task to edit
  • 3. Container Setting
  • 1) Logging - Copy the token of the application created in Application Management
  • 2) In Container Details - Settings - Environment Variables tab, set environment variables as follows
  • 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. Manual measurement of file logs(SDK)

Python

This is a method of installing into an existing application using the SDK provided by Opentelemetry. Logging in Python is currently under development at opentelemetry.

PreviousJavaNextManual measurement of file logs (Sidecar)

Last updated 1 year ago

Was this helpful?

This guide is for existing Python applications that have been build on Cocktail Cloud.

Additionally, the Python application in this guide was created based on 'Flask'

1. Image creation via SDK

1) Build/Pipeline - Build details of the Python application for which you want to collect logs from the build.

2) Click on the image build task to edit

...

# flask 애플리케이션용 opentelemetry Sdk 다운로드
RUN pip install --upgrade pip && pip install opentelemetry-distro && opentelemetry-bootstrap -a install && pip install flask

# Log를 Export할 필수설정
ENV OTEL_EXPORTER_OTLP_ENDPOINT=$OTEL_EXPORTER_OTLP_ENDPOINT
ENV OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=$OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
ENV OTEL_EXPORTER_OTLP_LOGS_HEADERS=$OTEL_EXPORTER_OTLP_LOGS_HEADERS
ENV OTEL_SERVICE_NAME=$OTEL_SERVICE_NAME
ENV OTEL_LOGS_EXPORTER=$OTEL_LOGS_EXPORTER

# Python 애플리케이션 로깅을 위한 필수 설정
ENV OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true

# metric과 trace를 수집하지 않기 위한 none 처리
ENV OTEL_METRICS_EXPORTER=none
ENV OTEL_TRACES_EXPORTER=none

...

3. Container Setting

1) Logging - Copy the token of the application created in Application Management

2) In Container Details - Settings - Environment Variables tab, set environment variables as follows

apiVersion: apps/v1
kind: Deployment
...
spec:
...
  template:
    spec:
      containers:
      - env:
	# opentelemetry collector svc address (eg. http://log-agent-cocktail-log-agent.cocktail-addon:4318)
	- name: OTEL_EXPORTER_OTLP_ENDPOINT
          value: {log-agent Service address}:4318

	# Log service address of opentelemetry collector (eg. http://log-agent-cocktail-log-agent.cocktail-addon:4318/v1/logs)
        - name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
          value: {log-agent Service address}:4318/v1/logs

	# Settings using opelemetry protocol
        - name: OTEL_LOGS_EXPORTER
          value: otlp_proto_http
        
	# 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
        ...

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

( http port = 4318 , grpc port = 4317)

4. Check Application Log

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