diff --git a/otel-agent/ecs-ec2/CHANGELOG.md b/otel-agent/ecs-ec2/CHANGELOG.md index dc3385d4..c6de5657 100644 --- a/otel-agent/ecs-ec2/CHANGELOG.md +++ b/otel-agent/ecs-ec2/CHANGELOG.md @@ -2,6 +2,9 @@ ## OpenTelemtry-Agent +### v0.0.31 / 2023-12-13 +* [FIX] fix config example files + ### v0.0.31 / 2023-10-17 * [FIX] log.file.path removal from coralogix exporter subsystem attributes 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 diff --git a/otel-agent/ecs-ec2/logging.yaml b/otel-agent/ecs-ec2/logging.yaml index 7d95406b..f58acbcd 100644 --- a/otel-agent/ecs-ec2/logging.yaml +++ b/otel-agent/ecs-ec2/logging.yaml @@ -1,4 +1,19 @@ receivers: + otlp: + protocols: + grpc: + endpoint: "0.0.0.0:4317" + 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: @@ -6,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"] processors: resourcedetection: @@ -20,22 +35,9 @@ processors: override: false ecsattributes: - attributes: - - ^image$ - - ^aws.* - - ^labels.* 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 @@ -44,20 +46,40 @@ processors: statements: - set(attributes["cx_container_id"], attributes["docker.id"]) - set(attributes["aws_ecs_task_family"], attributes["aws.ecs.task.definition.family"]) - + - set(attributes["image_id"], attributes["image.id"]) + - delete_key(attributes, "image.id") + + # otel-collector resource detection for collector + resourcedetection/otel-collector: + detectors: [ecs, ec2] + timeout: 2s + override: false + exporters: + logging: + verbosity: detailed coralogix: domain: "$CORALOGIX_DOMAIN" private_key: "$PRIVATE_KEY" 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: @@ -65,8 +87,25 @@ service: processors: - resourcedetection - ecsattributes - - filter/ecslogs - transform/logs exporters: - coralogix + traces: + receivers: + - otlp + exporters: + - coralogix + + metrics/otel-collector: + receivers: + - prometheus + processors: + - resourcedetection/otel-collector + exporters: + - coralogix + + telemetry: + metrics: + address: 0.0.0.0:8888 + level: detailed