diff --git a/otel-agent/ecs-ec2/config.yaml b/otel-agent/ecs-ec2/config.yaml index 2c5d1133..edf4c754 100644 --- a/otel-agent/ecs-ec2/config.yaml +++ b/otel-agent/ecs-ec2/config.yaml @@ -6,6 +6,14 @@ receivers: http: endpoint: "0.0.0.0:4318" + prometheus: + config: + scrape_configs: + - job_name: otel-collector-metrics + scrape_interval: 60s + static_configs: + - targets: ['localhost:8888'] + filelog: start_at: end include: @@ -13,11 +21,11 @@ receivers: include_file_path: true - # add log.file.name to resource attributes + # add log.file.path to resource attributes operators: - type: move - from: attributes["log.file.name"] - to: resource["log.file.name"] + from: attributes["log.file.path"] + to: resource["log.file.path"] # add metrics awsecscontainermetricsd: @@ -32,16 +40,7 @@ processors: ecsattributes: container_id: sources: - - "log.file.name" - - # only allow logs with container.name label - filter/ecslogs: - logs: - include: - match_type: regexp - resource_attributes: - - key: aws.ecs.container.name - value: '.*' + - "log.file.path" transform/logs: error_mode: ignore @@ -54,7 +53,13 @@ processors: - delete_key(attributes, "image.id") batch: - + + # otel-collector resource detection for collector + resourcedetection/otel-collector: + detectors: [ecs, ec2] + timeout: 2s + override: false + exporters: logging: coralogix: @@ -63,12 +68,21 @@ exporters: application_name: "$APP_NAME" subsystem_name: "$SUB_SYS" application_name_attributes: + - "aws.ecs.cluster" + - "aws.ecs.cluster.name" - "aws.ecs.task.definition.family" subsystem_name_attributes: + - "aws.ecs.container.name" + - "aws.ecs.docker.name" - "docker.name" timeout: 30s + +extensions: + health_check: service: + extensions: + - health_check pipelines: logs: receivers: @@ -76,7 +90,6 @@ service: processors: - resourcedetection - ecsattributes - - filter/ecslogs - transform/logs exporters: - coralogix @@ -95,4 +108,17 @@ service: processors: - batch exporters: - - coralogix \ No newline at end of file + - coralogix + + metrics/otel-collector: + receivers: + - prometheus + processors: + - resourcedetection/otel-collector + exporters: + - coralogix + + telemetry: + metrics: + address: 0.0.0.0:8888 + level: detailed