DevOps help for Cloud Platform Engineers
  • Welcome!
  • Quick Start Guide
  • About Me
  • CV
  • 🧠DevOps & SRE Foundations
    • DevOps Overview
      • Engineering Fundamentals
      • Implementing DevOps Strategy
      • DevOps Readiness Assessment
      • Lifecycle Management
      • The 12 Factor App
      • Design for Self Healing
      • Incident Management Best Practices (2025)
    • SRE Fundamentals
      • Toil Reduction
      • System Simplicity
      • Real-world Scenarios
        • AWS VM Log Monitoring API
    • Agile Development
      • Team Agreements
        • Definition of Done
        • Definition of Ready
        • Team Manifesto
        • Working Agreement
    • Industry Scenarios
      • Finance and Banking
      • Public Sector (UK/EU)
      • Energy Sector Edge Computing
  • DevOps Practices
    • Platform Engineering
    • FinOps
    • Observability
      • Modern Practices
  • 🚀Modern DevOps Practices
    • Infrastructure Testing
    • Modern Development
    • Database DevOps
  • 🛠️Infrastructure as Code (IaC)
    • Terraform
      • Getting Started - Installation and initial setup [BEGINNER]
      • Cloud Integrations - Provider-specific implementations
        • Azure Scenarios
        • AWS Scenarios
        • GCP Scenarios
      • Testing and Validation - Ensuring infrastructure quality
        • Unit Testing
        • Integration Testing
        • End-to-End Testing
        • Terratest Guide
      • Best Practices - Production-ready implementation strategies
        • State Management
        • Security
        • Code Organization
        • Performance
      • Tools & Utilities - Enhancing the Terraform workflow
        • Terraform Docs
        • TFLint
        • Checkov
        • Terrascan
      • CI/CD Integration - Automating infrastructure deployment
        • GitHub Actions - GitHub-based automation workflows
        • Azure Pipelines - Azure DevOps integration
        • GitLab CI - GitLab-based deployment pipelines
    • Bicep
      • Getting Started - First steps with Bicep [BEGINNER]
      • Template Specs
      • Best Practices - Guidelines for effective Bicep implementations
      • Modules - Building reusable components [INTERMEDIATE]
      • Examples - Sample implementations for common scenarios
      • Advanced Features
      • CI/CD Integration - Automating Bicep deployments
        • GitHub Actions
        • Azure Pipelines
  • 💰Cost Management & FinOps
    • Cloud Cost Optimization
  • 🐳Containers & Orchestration
    • Containerization Overview
    • Docker
      • Dockerfile Best Practices
      • Docker Compose
    • Kubernetes
      • CLI Tools - Essential command-line utilities
        • Kubectl
        • Kubens
        • Kubectx
      • Core Concepts
      • Components
      • Best Practices
        • Pod Security
        • Security Monitoring
        • Resource Limits
      • Advanced Features - Beyond the basics [ADVANCED]
        • Service Mesh
        • Ingress Controllers
          • NGINX
          • Traefik
          • Kong
          • Gloo Edge
      • Troubleshooting - Diagnosing and resolving common issues
        • Pod Troubleshooting Commands
      • Enterprise Architecture
      • Health Management
      • Security & Compliance
      • Virtual Clusters
    • OpenShift
  • Service Mesh & Networking
    • Service Mesh Implementation
  • Architecture Patterns
    • Data Mesh
    • Multi-Cloud Networking
    • Disaster Recovery
    • Chaos Engineering
  • Edge Computing
    • Implementation Guide
    • Serverless Edge
    • IoT Edge Patterns
    • Real-Time Processing
    • Edge AI/ML
    • Security Hardening
    • Observability Patterns
    • Network Optimization
    • Storage Patterns
  • 🔄CI/CD & GitOps
    • CI/CD Overview
    • Continuous Integration
    • Continuous Delivery
      • Deployment Strategies
      • Secrets Management
      • Blue-Green Deployments
      • Deployment Metrics
      • Progressive Delivery
      • Release Management for DevOps/SRE (2025)
    • CI/CD Platforms - Tool selection and implementation
      • Azure DevOps
        • Pipelines
          • Stages
          • Jobs
          • Steps
          • Templates - Reusable pipeline components
          • Extends
          • Service Connections - External service authentication
          • Best Practices for 2025
          • Agents and Runners
          • Third-Party Integrations
          • Azure DevOps CLI
        • Boards & Work Items
      • GitHub Actions
      • GitLab
        • GitLab Runner
        • Real-life scenarios
        • Installation guides
        • Pros and Cons
        • Comparison with alternatives
    • GitOps
      • Modern GitOps Practices
      • GitOps Patterns for Multi-Cloud (2025)
      • Flux
        • Overview
        • Progressive Delivery
        • Use GitOps with Flux, GitHub and AKS
  • Source Control
    • Source Control Overview
    • Git Branching Strategies
    • Component Versioning
    • Kubernetes Manifest Versioning
    • GitLab
    • Creating a Fork
    • Naming Branches
    • Pull Requests
    • Integrating LLMs into Source Control Workflows
  • ☁️Cloud Platforms
    • Cloud Strategy
    • Azure
      • Best Practices
      • Landing Zones
      • Services
      • Monitoring
      • Administration Tools - Platform management interfaces
        • Azure PowerShell
        • Azure CLI
      • Tips & Tricks
    • AWS
      • Authentication
      • Best Practices
      • Tips & Tricks
    • Google Cloud
      • Services
    • Private Cloud
  • 🔐Security & Compliance
    • DevSecOps Overview
    • DevSecOps Pipeline Security
    • DevSecOps
      • Real-life Examples
      • Scanning & Protection - Automated security tooling
        • Dependency Scanning
        • Credential Scanning
        • Container Security Scanning
        • Static Code Analysis
          • Best Practices
          • Tool Integration Guide
          • Pipeline Configuration
      • CI/CD Security
      • Secrets Rotation
    • Supply Chain Security
      • SLSA Framework
      • Binary Authorization
      • Artifact Signing
    • Security Best Practices
      • Threat Modeling
      • Kubernetes Security
    • SecOps
    • Zero Trust Model
    • Cloud Compliance
      • ISO/IEC 27001:2022
      • ISO 22301:2019
      • PCI DSS
      • CSA STAR
    • Security Frameworks
    • SIEM and SOAR
  • Security Architecture
    • Zero Trust Implementation
      • Identity Management
      • Network Security
      • Access Control
  • 🔍Observability & Monitoring
    • Observability Fundamentals
    • Logging
    • Metrics
    • Tracing
    • Dashboards
    • SLOs and SLAs
    • Observability as Code
    • Pipeline Observability
  • 🧪Testing Strategies
    • Testing Overview
    • Modern Testing Approaches
    • End-to-End Testing
    • Unit Testing
    • Performance Testing
      • Load Testing
    • Fault Injection Testing
    • Integration Testing
    • Smoke Testing
  • 🤖AI Integration
    • AIops Overview
      • Workflow Automation
      • Predictive Analytics
      • Code Quality
  • 🧠AI & LLM Integration
    • Overview
    • Claude
      • Installation Guide
      • Project Guides
      • MCP Server Setup
      • LLM Comparison
    • Ollama
      • Installation Guide
      • Configuration
      • Models and Fine-tuning
      • DevOps Usage
      • Docker Setup
      • GPU Setup
      • Open WebUI
    • Copilot
      • Installation Guide
      • VS Code Integration
      • CLI Usage
    • Gemini
      • Installation Guides - Platform-specific setup
        • Linux Installation
        • WSL Installation
        • NixOS Installation
      • Gemini 2.5 Features
      • Roles and Agents
      • NotebookML Guide
      • Cloud Infrastructure Deployment
      • Summary
  • 💻Development Environment
    • Tools Overview
    • DevOps Tools
    • Operating Systems - Development platforms
      • NixOS
        • Installation
        • Nix Language Guide
        • DevEnv with Nix
        • Cloud Deployments
      • WSL2
        • Distributions
        • Terminal Setup
    • Editor Environments
    • CLI Tools
      • Azure CLI
      • PowerShell
      • Linux Commands
      • YAML Tools
  • 📚Programming Languages
    • Python
    • Go
    • JavaScript/TypeScript
    • Java
    • Rust
  • 📖Documentation Best Practices
    • Documentation Strategy
    • Project Documentation
    • Release Notes
    • Static Sites
    • Documentation Templates
    • Real-World Examples
  • 📋Reference Materials
    • Glossary
    • Tool Comparison
    • Recommended Reading
    • Troubleshooting Guide
  • Platform Engineering
    • Implementation Guide
  • FinOps
    • Implementation Guide
  • AIOps
    • LLMOps Guide
  • Development Setup
    • Development Setup
Powered by GitBook
On this page
  • Overview
  • Collection Methods
  • Best Practices
  • Real-Life Examples and Scenarios (2025)
  • Recommended Tools
  • 2025 Logging Architecture Patterns
Edit on GitHub
  1. Observability & Monitoring

Logging

PreviousObservability FundamentalsNextMetrics

Last updated 1 day ago

Overview

Logs are discrete events with the goal of helping engineers identify problem area(s) during failures.

Collection Methods

When it comes to log collection methods, two of the standard techniques are a direct-write, or an agent-based approach.

Directly written log events are handled in-process of the particular component, usually utilizing a provided library. has direct send capabilities, but it's not recommended for serious/production use. This approach has some advantages:

  • There is no external process to configure or monitor

  • No log file management (rolling, expiring) to prevent out of disk space issues.

The potential trade-offs of this approach:

  • Potentially higher memory usage if the library is using a memory backed buffer.

  • In the event of an extended service outage, log data may get dropped or truncated due to buffer constraints.

  • Multiple component process logging will manage & emit logs individually, which can be more complex to manage for the outbound load.

Agent-based log collection relies on an external process running on the host machine, with the component emitting log data stdout or file. Writing log data to stdout is the preferred practice when running applications within a container environment like Kubernetes. The container runtime redirects the output to files, which can then be processed by an agent. , and are examples of log shipping agents.

There are several advantages when using an agent to collect & ship log files:

  • Centralized configuration.

  • Collecting multiple sources of data with a single process.

  • Local pre-processing & filtering of log data before sending it to a central service.

  • Utilizing disk space as a data buffer during a service disruption.

This approach isn't without trade-offs:

  • Required exclusive CPU & memory resources for the processing of log data.

  • Persistent disk space for buffering.

Best Practices

2025 Logging Best Practices

  • Zero-Trust Logging: Implement cryptographic signatures for logs to ensure integrity and non-repudiation in zero-trust environments.

  • AI-Assisted Log Analysis: Leverage LLM-powered log analysis tools to automatically identify patterns and anomalies without manual query writing.

  • eBPF-Based Logging: Use extended Berkeley Packet Filter (eBPF) technology for kernel-level logging with minimal performance impact.

  • Vector-Based Storage: Store logs in vector databases to enable semantic search capabilities across massive log datasets.

  • Real-Time Compliance Validation: Implement automated compliance scanning on log streams to flag PII or regulatory violations before they reach storage.

Established Best Practices

  • Pay attention to logging levels. Logging too much will increase costs and decrease application throughput.

  • Ensure logging configuration can be modified without code changes. Ideally, make it changeable without application restarts.

  • If available, take advantage of logging levels per category allowing granular logging configuration.

  • Check for log levels before logging, thus avoiding allocations and string manipulation costs.

  • Ensure service versions are included in logs to be able to identify problematic releases.

  • Log a raised exception only once. In your handlers, only catch expected exceptions that you can handle gracefully (even with a specific return code). If you want to log and rethrow, leave it to the top level exception handler. Do the minimal amount of cleanup work needed then throw to maintain the original stack trace. Don't log a warning or stack trace for expected exceptions (eg: properly expected 404, 403 HTTP statuses).

  • Fine tune logging levels in production (>= warning for instance). During a new release the verbosity can be increased to facilitate bug identification.

  • If using sampling, implement this at the service level rather than defining it in the logging system. This way we have control over what gets logged. An additional benefit is reduced number of roundtrips.

  • Only include failures from health checks and non-business driven requests.

  • Ensure a downstream system malfunction won't cause repetitive logs being stored.

  • Don't reinvent the wheel, use existing tools to collect and analyze the data.

  • Ensure personal identifiable information policies and restrictions are followed.

  • Ensure errors and exceptions in dependent services are captured and logged. For example, if an application uses Redis cache, Service Bus or any other service, any errors/exceptions raised while accessing these services should be captured and logged.

Log Retention and Cost Management (2025)

  • Tiered Log Storage: Implement multi-tiered log storage with hot, warm, and cold tiers based on access patterns and compliance requirements.

  • Dynamic Retention Policies: Use machine learning to automatically adjust retention periods based on the criticality and usage patterns of different log types.

  • Compute-Adjacent Storage: Position log storage infrastructure in the same availability zones as compute to minimize cross-zone data transfer costs.

  • Federated Query Engines: Deploy federated query systems to analyze logs across multiple storage backends without data duplication.

If there's sufficient log data, is there a need for instrumenting metrics?

In 2025, the distinction has evolved with the rise of unified observability platforms that automatically derive metrics from logs and correlate them with traces. However, direct instrumentation of critical metrics remains beneficial for performance and cost reasons, particularly for high-cardinality data points.

Real-Life Examples and Scenarios (2025)

Case Study 1: Financial Services API Platform

A major financial services company implemented a new logging strategy for their API platform serving 50+ million daily transactions:

{
  "timestamp": "2025-03-15T14:23:45.232Z",
  "service": "payment-gateway",
  "version": "3.4.2",
  "instance": "pod-23a7f",
  "trace_id": "abc123def456ghi789",
  "span_id": "span456def",
  "level": "ERROR",
  "message": "Payment processing timeout",
  "context": {
    "merchant_id": "m-28937423", 
    "transaction_type": "debit",
    "amount": 432.19,
    "currency": "USD",
    "processing_time_ms": 30214,
    "timeout_threshold_ms": 3000
  },
  "resource": {
    "payment_processor": "external-gateway-2",
    "region": "us-east-1",
    "endpoint": "/api/v2/process"
  },
  "signature": "ed25519:a97b5e8d23f0cac9..."
}

Key Implementation Details:

  • Log events are cryptographically signed to maintain chain of custody for compliance

  • Context contains business-relevant information without PII

  • Standardized schema enables automated triage and routing

  • Integration with their vector database allows semantic querying like "find all payment timeout errors affecting high-value transactions"

Case Study 2: Kubernetes Cluster Autoscaling Events

A global SaaS provider implemented eBPF-based logging to capture autoscaling decisions in their Kubernetes environment:

timestamp: 2025-04-22T09:12:34Z
event_type: cluster_autoscaling_decision
cluster_id: prod-east-12
scaling_action: node_addition
details:
  node_pool: compute-optimized-4
  previous_count: 17
  new_count: 22
  trigger:
    type: resource_pressure
    resource: memory
    current_utilization: 87%
    threshold: 80%
  workloads_impacted:
    - namespace: customer-facing
      deployment: recommendation-engine
      replicas_pending: 7
  estimated_cost_impact:
    daily_increase_usd: 42.85
    monthly_forecast_usd: 1285.50

This logging approach allowed them to correlate infrastructure scaling events with business impact and costs, leading to a 23% reduction in cloud spending by optimizing autoscaling parameters based on historical patterns.

Having problems identifying what to log?

At application startup:

  • Unrecoverable errors from startup.

  • Warnings if application still runnable, but not as expected (i.e. not providing blob connection string, thus resorting to local files. Another example is if there's a need to fail back to a secondary service or a known good state, because it didn't get an answer from a primary dependency.)

  • Information about the service's state at startup (build #, configs loaded, etc.)

  • Runtime environment details such as container orchestration metadata, cloud provider region, and infrastructure generation.

  • Service mesh configuration and connectivity status.

Per incoming request:

  • Basic information for each incoming request: the url (scrubbed of any personally identifying data, a.k.a. PII), any user/tenant/request dimensions, response code returned, request-to-response latency, payload size, record counts, etc. (whatever you need to learn something from the aggregate data)

  • Warning for any unexpected exceptions, caught only at the top controller/interceptor and logged with or alongside the request info, with stack trace. Return a 500. This code doesn't know what happened.

  • Feature flag evaluations that affected request processing.

  • AI/ML model versions used for request processing, including confidence scores.

Per outgoing request:

  • Basic information for each outgoing request: the url (scrubbed of any personally identifying data, a.k.a. PII), any user/tenant/request dimensions, response code returned, request-to-response latency, payload sizes, record counts returned, etc. Report perceived availability and latency of dependencies and including slicing/clustering data that could help with later analysis.

  • Circuit breaker status and fallback strategy activations.

  • API version and deprecation warnings from dependencies.

Recommended Tools

2025 Logging Architecture Patterns

Hybrid Edge-Cloud Processing

Modern logging architectures now commonly implement a tiered approach:

  1. Edge Processing: Initial log aggregation and filtering at the edge

  2. Regional Consolidation: Normalized logs routed to regional processing centers

  3. Central Analysis: Long-term storage and cross-regional analysis in core infrastructure

This pattern has become standard for global applications needing to balance performance, sovereignty requirements, and global visibility.

Example Architecture Diagram

┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│  Application  │     │  Application  │     │  Application  │
│  Containers   │     │  Containers   │     │  Containers   │
└───────┬───────┘     └───────┬───────┘     └───────┬───────┘
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│  Vector Agent │     │  Vector Agent │     │  Vector Agent │
│  (eBPF mode)  │     │  (eBPF mode)  │     │  (eBPF mode)  │
└───────┬───────┘     └───────┬───────┘     └───────┬───────┘
        │                     │                     │
        └─────────┬───────────┴─────────┬───────────┘
                  │                     │
                  ▼                     ▼
        ┌───────────────┐     ┌───────────────┐
        │ Regional Log  │     │ Regional Log  │
        │ Aggregator    │     │ Aggregator    │
        └───────┬───────┘     └───────┬───────┘
                │                     │
                └─────────┬───────────┘
                          │
                          ▼
                ┌───────────────────┐
                │  Central Log      │
                │  Storage & ML     │
                └─────────┬─────────┘
                          │
            ┌─────────────┴─────────────┐
            │                           │
            ▼                           ▼
┌───────────────────┐       ┌───────────────────┐
│  Compliance &     │       │   Visualization   │
│  Audit Storage    │       │   & Analysis      │
└───────────────────┘       └───────────────────┘

This architecture enables real-time log analysis while maintaining compliance with data sovereignty and retention requirements.

covers some high level guidance on when to utilize metric data and when to use log data. Both have a valuable part to play in creating observable systems.

- Umbrella of services including system metrics, log analytics and more. Now featuring AI-powered insights with Azure Monitor Copilot.

- An open source log aggregation platform, built on the learnings from the Prometheus Community for highly efficient collection & storage of log data at scale. Now with vector search capabilities.

- An open source log analytics tech stack utilizing Logstash, Beats, Elastic search and Kibana with advanced ML capabilities.

- Open source dashboard & visualization tool. Supports Log, Metrics and Distributed tracing data sources with 2025's addition of natural language querying.

- The CNCF standard for logs collection that integrates seamlessly with distributed traces and metrics.

- High-performance observability pipeline for collecting, transforming, and routing logs with eBPF capabilities.

- Open source security monitoring with advanced log analysis for threat detection and compliance monitoring.

🔍
Azure Monitor
Azure Monitor
Grafana Loki
Elastic's Logstash
Fluent Bit
Logs vs Metrics vs Traces
Azure Monitor
Grafana Loki
The Elastic Stack
Grafana
OpenTelemetry Logging
Vector
Wazuh