USD ($)
$
United States Dollar
Euro Member Countries
India Rupee
د.إ
United Arab Emirates dirham
ر.س
Saudi Arabia Riyal

Centralised Logging with Amazon OpenSearch Service

Lesson 39/50 | Study Time: 60 Min

CloudWatch Logs works well for individual services. But as your infrastructure grows — multiple applications, multiple environments, dozens of Lambda functions, ECS services, EC2 instances, logs become scattered across many separate log groups.

Finding the root cause of an issue that spans multiple services means jumping between log groups and manually correlating events.

Amazon OpenSearch Service solves this by giving you a single place where all logs are aggregated, indexed, and searchable in real time across your entire infrastructure.

What is Amazon OpenSearch Service?

Amazon OpenSearch Service is a managed search and analytics engine built on OpenSearch , the open-source fork of Elasticsearch.

It ingests large volumes of log data, indexes it automatically, and lets you search and analyse it using full-text queries, filters, and aggregations.

For DevOps teams, OpenSearch is primarily used as the core of a centralised logging platform, a single destination where logs from every service flow into and where engineers go to search, analyse, and visualise log data.

The Centralised Logging Architecture

The most common pattern for centralised logging on AWS uses three components working together:

Logs from all sources flow into a collection layer, either CloudWatch Logs or Kinesis Data Firehose, which delivers them to OpenSearch in near real time. OpenSearch indexes every log entry and makes it instantly searchable.

Getting Logs Into OpenSearch


From CloudWatch Logs

CloudWatch Logs can be configured to stream log data directly to OpenSearch using a subscription filter.

You define a filter on a CloudWatch log group and CloudWatch automatically forwards matching log entries to an OpenSearch domain via a Lambda function.

This is the simplest approach, if your logs already go to CloudWatch, adding a subscription filter to forward them to OpenSearch requires minimal configuration.


From Kinesis Data Firehose

For higher-volume log streams — VPC Flow Logs, CloudTrail events, application logs at scale — Kinesis Data Firehose is the better collection layer.

Firehose buffers log data and delivers it to OpenSearch in batches, providing better throughput and built-in error handling. If delivery fails, Firehose automatically backs up failed records to S3.

Firehose also supports data transformation, you can run a Lambda function on each batch to parse, enrich, or filter log data before it reaches OpenSearch.

OpenSearch Dashboards

OpenSearch Dashboards, previously called Kibana is the built-in visualisation tool that comes with OpenSearch Service. It provides a browser-based interface for searching logs, building visualisations, and creating operational dashboards.


Key Capabilities:


1. Discover: The primary log search interface. You write queries, apply time filters, and browse individual log entries. Full-text search across all indexed fields means you can find any log entry in seconds regardless of which service produced it.


2. Visualisations: Build charts, graphs, and tables from your log data — error rate over time, top error messages by frequency, request volume by service, geographic distribution of traffic.


3. Dashboards: Combine multiple visualisations into a single operational view. A centralised logging dashboard might show error rates across all services, the top 10 most frequent error messages, and a time-series view of log volume — all in one screen.


4. Alerts: OpenSearch Dashboards supports alerting — define a condition based on a log query and receive a notification when that condition is met. For example, alert when more than 100 error log entries appear within a 5-minute window.

Structuring Logs for OpenSearch

OpenSearch is significantly more powerful when logs are structured. Structured logs, written as JSON are parsed and indexed field by field, making every field individually searchable and filterable.


A structured log entry from a Lambda function:

With this structure, you can search for all errors from the payment service, filter by a specific user, or find all requests that took longer than 5 seconds — instantly, across millions of log entries.

Plain text logs require more complex parsing and produce significantly less useful search results.

Index Management

Every log entry stored in OpenSearch occupies storage. As log volume grows, managing indices becomes important for both cost and performance.


1. Index State Management (ISM): ISM lets you define automated policies for your indices. For example, move indices older than 7 days from hot storage to warm storage, and delete indices older than 30 days automatically. This keeps storage costs controlled without manual cleanup.


2. Index templates: Define the mapping and settings for new indices automatically so every new log index has the correct field types and storage configuration from the moment it is created.

Security Considerations

Drew Collins

Drew Collins

Product Designer
Profile

Class Sessions

1- What is DevOps? Principles, Culture, and Practices 2- The DevOps Lifecycle 3- Introduction to Cloud Computing 4- AWS Global Infrastructure 5- Core AWS Services Overview 6- Git Fundamentals 7- Branching Strategies 8- Pull Requests and Code Review Best Practices 9- Integrating Git with AWS CodeCommit and GitHub 10- Managing Secrets and Sensitive Files in Repositories 11- What is CI/CD? 12- Building Pipelines with AWS CodePipeline and CodeBuild 13- Automated Testing in CI 14- Deployment Strategies 15- Using GitHub Actions and Jenkins on AWS 16- Why Infrastructure as Code (IaC)? 17- AWS CloudFormation 18- Terraform on AWS 19- AWS Cloud Development Kit (CDK) 20- IaC Best Practices 21- Docker Fundamentals 22- Amazon ECR 23- Deploying Containers with Amazon ECS 24- Kubernetes Basics and Amazon EKS 25- Integrating Containers into CI/CD Pipelines 26- Serverless Computing Concepts and Use Cases 27- Building and Deploying AWS Lambda Functions 28- Event-Driven Automation with Amazon EventBridge 29- Orchestrating Workflows with AWS Step Functions 30- API Gateway Integration for Serverless APIs 31- Introduction to MLOps 32- Training and Deploying Models with Amazon SageMaker 33- Automating ML Pipelines with SageMaker Pipelines 34- Using Amazon CodeWhisperer and AI Tools for Code Automation 35- AI-Powered Testing, Anomaly Detection, and Incident Prediction 36- Observability Fundamentals 37- Amazon CloudWatch 38- Distributed Tracing with AWS X-Ray 39- Centralised Logging with Amazon OpenSearch Service 40- Setting Up Automated Alerts and Incident Response Workflows 41- Shift-Left Security 42- IAM Roles, Policies, and Least-Privilege Access 43- Static Code Analysis and Vulnerability Scanning in CI/CD 44- AWS Security Hub, GuardDuty, and Config for Compliance 45- Secrets Management with AWS Secrets Manager and Parameter Store 46- AWS Well-Architected Framework 47- Auto Scaling and Elastic Load Balancing for Resilience 48- Cost Monitoring with AWS Cost Explorer and Budgets 49- Disaster Recovery Strategies 50- Preparing Your Project for Production