opensearch-project / opensearch-project/data-prepper

CloudWatch Logs as Source

Open
#1,994 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement plugin - source
Dominant language
Java
Stars
374
Forks
354
Avg merge
3d 18h
Merged PRs (30d)
8

Description

Is your feature request related to a problem? Please describe.

Pipeline authors wanted to get Logs out of Amazon Cloud Watch to send to either OpenSearch or Prometheus

Describe the solution you'd like

Create a CloudWatch source plugin which retrieves logs from CloudWatch.I t should put logs into the Data Prepper in the current Metrics model, which is based on the OpenTelemetry specification.

source:
    cloudwatch:
    namespace: ES/OpenSearchService
    log_source: logspath
    dimensions:
      - name: DomainName
        value: my-domain

As this is a polling source, it should also allow pipeline authors to define a poll interval similar to the S3 source.

Describe alternatives you've considered (Optional)

Additional context

https://aws.amazon.com/premiumsupport/knowledge-center/cloudwatch-logs-retrieve-data/
https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/Welcome.html
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html

Source:
  cloudwatch:
    logs :
          log_group_1
          log_group_2
 
   metrics :
            metrics_1
            metrics_1

Sample Metric Data:

Sample query - aws cloudwatch get-metric-data --cli-input-json file:///data.json

Data.json - would be like below

{
    "MetricDataQueries": [
        {
            "Id": "myRequest",
            "MetricStat": {
                "Metric": {
                    "Namespace": "AWS/EBS",
                    "MetricName": "VolumeReadBytes",
                    "Dimensions": [
                        {
                            "Name": "VolumeId",
                            "Value": "vol-a"
                        }
                    ]
                },
                "Period": 3600,
                "Stat": "Average",
                "Unit": "Bytes"
            },
            "Label": "myRequestLabel",
            "ReturnData": true
        }
    ],
    "StartTime": "2023-06-01T10:40:0000",
    "EndTime": "2023-06-27T14:12:0000"
}

Result-

{
    "MetricDataResults": [
        {
            "Id": "myRequest",
            "Label": "myRequestLabel",
            "Timestamps": [
                "2023-06-21T13:40:00+00:00",
                "2023-06-21T12:40:00+00:00",
                "2023-06-21T11:40:00+00:00",
                "2023-06-21T10:40:00+00:00",
                "2023-06-21T09:40:00+00:00",
                "2023-06-21T08:40:00+00:00",
                "2023-06-21T07:40:00+00:00",
                "2023-06-21T06:40:00+00:00",
                "2023-06-21T05:40:00+00:00",
                "2023-06-21T04:40:00+00:00",
                "2023-06-21T03:40:00+00:00",
                "2023-06-21T02:40:00+00:00",
                "2023-06-21T01:40:00+00:00"  
      ],
            "Values": [
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,5939.2,
                341.3333333333333,
                2184.5333333333333,
                26785848.888888888
            ],
            "StatusCode": "Complete"
        }
    ],
    "Messages": []

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing S3 source conventions, the source coordinator requirements, and the ACE metrics batching framework. Consult the linked CloudWatch Logs and GetMetricData APIs to define the source scope, configuration, polling, and multi-node behavior. Done means a documented CloudWatch source design with clear log and metric output requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java
Domain
backend, cloud, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.