Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: extension/encoding

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add most of the AWS ELB fields to the AWSLogsEncoding.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [43757]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
68 changes: 36 additions & 32 deletions extension/encoding/awslogsencodingextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,38 +362,42 @@ ELB access log record fields are mapped this way in the resulting OpenTelemetry
> AWS Fields are according to [documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html).


| **AWS Field** | **OpenTelemetry Field(s)** |
|------------------------------|----------------------------------------------------------------------|
| type | `network.protocol.name` |
| time | Log timestamp |
| elb | `cloud.resource_id` |
| client:port | `client.address`, `client.port` |
| received_bytes | `http.request.size` |
| sent_bytes | `http.response.size` |
| "request" | `url.full`, `http.request.method`, `network.protocol.version` |
| ssl_cipher | `tls.cipher` |
| ssl_protocol | `tls.protocol.version` |
| elb_status_code | `aws.elb.status.code` |
| user_agent | `user_agent.original` |
| domain_name | `url.domain` |
| target:port | _Currently not supported_ |
| request_processing_time | _Currently not supported_ |
| target_processing_time | _Currently not supported_ |
| response_processing_time | _Currently not supported_ |
| target_status_code | _Currently not supported_ |
| target_group_arn | _Currently not supported_ |
| "trace_id" | _Currently not supported_ |
| "chosen_cert_arn" | _Currently not supported_ |
| matched_rule_priority | _Currently not supported_ |
| request_creation_time | _Currently not supported_ |
| "actions_executed" | _Currently not supported_ |
| "redirect_url" | _Currently not supported_ |
| "error_reason" | _Currently not supported_ |
| "target:port_list" | _Currently not supported_ |
| "target_status_code_list" | _Currently not supported_ |
| "classification" | _Currently not supported_ |
| "classification_reason" | _Currently not supported_ |
| conn_trace_id | _Currently not supported_ |
| **AWS Field** | **OpenTelemetry Field(s)** |
|---------------------------|---------------------------------------------------------------|
| type | `network.protocol.name` |
| time | Log timestamp |
| elb | `cloud.resource_id` |
| client:port | `client.address`, `client.port` |
| received_bytes | `http.request.size` |
| sent_bytes | `http.response.size` |
| "request" | `url.full`, `http.request.method`, `network.protocol.version` |
| ssl_cipher | `tls.cipher` |
| ssl_protocol | `tls.protocol.version` |
| elb_status_code | `aws.elb.status.code` |
| user_agent | `user_agent.original` |
| domain_name | `url.domain` |
| target:port | `destination.address`, `destination.port` |
| request_processing_time | `aws.alb.request_processing_time` |
| target_processing_time | `aws.elb.target_processing_time` |
| response_processing_time | `aws.elb.response_processing_time` |
| target_status_code | `aws.elb.backend.status.code` |
| target_group_arn | `aws.elb.target_group_arn` |
| "trace_id" | `aws.elb.aws_trace_id` |
| "chosen_cert_arn" | `aws.elb.chosen_cert_arn` |
| matched_rule_priority | _Currently not supported_ |
| request_creation_time | _Currently not supported_ |
| "actions_executed" | `aws.elb.actions_executed` |
| "redirect_url" | `aws.elb.redirect_url` |
| "error_reason" | `aws.elb.error_reason` |
| "target:port_list" | _Currently not supported_ |
| "target_status_code_list" | _Currently not supported_ |
| "classification" | `aws.elb.classification` |
| "classification_reason" | `aws.elb.classification_reason` |
| conn_trace_id | `aws.elb.connection_trace_id` |
| transformed_host | `aws.elb.transformed_host` |
| transformed_uri | `aws.elb.transformed_uri` |
| request_transform_status | `aws.elb.request_transform_status` |


#### Network Load Balancer (NLB)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ type ALBAccessLogRecord struct {
TargetIPPort string // Target IP:Port or -
TargetIP string // Target IP
TargetPort int64 // Target port
RequestProcessingTime string // Time taken to process the request in seconds
TargetProcessingTime string // Time taken for the target to process the request in seconds
ResponseProcessingTime string // Time taken to send the response to the client in seconds
RequestProcessingTime string // Time taken to process the request in milliseconds
TargetProcessingTime string // Time taken for the target to process the request in milliseconds
ResponseProcessingTime string // Time taken to send the response to the client in milliseconds
ELBStatusCode int64 // Status code from the load balancer
TargetStatusCode string // Status code from the target
ReceivedBytes int64 // Size of the request in bytes
Expand All @@ -264,6 +264,10 @@ type ALBAccessLogRecord struct {
TargetStatusCodeList string // List of status codes from targets
Classification string // Classification of the request
ClassificationReason string // Reason for classification
ConnectionTraceID string // The connection traceability ID
TransformedHost string // The transformed host header
TransformedURI string // The URI after it is modified by a URL rewrite transform
RequestTransformStatus string // The status of the rewrite transform
}

// convertTextToALBAccessLogRecord converts a slice of strings into a ALBAccessLogRecord
Expand Down Expand Up @@ -299,6 +303,18 @@ func convertTextToALBAccessLogRecord(fields []string) (ALBAccessLogRecord, error
TargetStatusCodeList: fields[26],
Classification: fields[27],
ClassificationReason: fields[28],
ConnectionTraceID: unknownField,
TransformedHost: unknownField,
TransformedURI: unknownField,
RequestTransformStatus: unknownField,
}
if len(fields) >= 30 {
record.ConnectionTraceID = fields[29]
}
if len(fields) >= 33 {
record.TransformedHost = fields[30]
record.TransformedURI = fields[31]
record.RequestTransformStatus = fields[32]
}
var clientPort string
if record.ClientIP, clientPort, err = net.SplitHostPort(fields[3]); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@
package elbaccesslogs // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/awslogsencodingextension/internal/unmarshaler/elb-access-log"

const (
AttributeELBStatusCode = "aws.elb.status.code" // int
AttributeELBBackendStatusCode = "aws.elb.backend.status.code" // int
AttributeTLSListenerResourceID = "aws.elb.tls.listener.resource_id" // string
AttributeELBStatusCode = "aws.elb.status.code" // int
AttributeELBBackendStatusCode = "aws.elb.backend.status.code" // int
AttributeTLSListenerResourceID = "aws.elb.tls.listener.resource_id" // string
AttributeELBRequestProcessingTime = "aws.elb.request_processing_time" // float
AttributeELBResponseProcessingTime = "aws.elb.response_processing_time" // float
AttributeELBTargetProcessingTime = "aws.elb.target_processing_time" // float
AttributeELBTargetGroupARN = "aws.elb.target_group_arn" // string
AttributeELBChosenCertARN = "aws.elb.chosen_cert_arn" // string
AttributeELBActionsExecuted = "aws.elb.actions_executed" // string
AttributeELBRedirectURL = "aws.elb.redirect_url" // string
AttributeELBErrorReason = "aws.elb.error_reason" // string
AttributeELBClassification = "aws.elb.classification" // string
AttributeELBClassificationReason = "aws.elb.classification_reason" // string
AttributeELBConnectionTraceID = "aws.elb.connection_trace_id" // string
AttributeELBTransformedHost = "aws.elb.transformed_host" // string
AttributeELBTransformedURI = "aws.elb.transformed_uri" // string
AttributeELBRequestTransformStatus = "aws.elb.request_transform_status" // string
AttributeELBAWSTraceID = "aws.elb.aws_trace_id" // string
)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 10.0.0.1:80 0.000 0.001 0.000 200 200 34 366 "GET http://www.example.com:80/ HTTP/1.1" "curl/7.46.0" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337262-36d228ad5d99923122bbe354" "-" "-" 0 2018-07-02T22:22:48.364000Z "forward,redirect" "-" "-" "10.0.0.1:80" "200" "-" "-"
invalid 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 10.0.0.1:80 0.000 0.001 0.000 200 200 34 366 "GET http://www.example.com:80/ HTTP/1.1" "curl/7.46.0" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337262-36d228ad5d99923122bbe354" "-" "-" 0 2018-07-02T22:22:48.364000Z "forward,redirect" "-" "-" "10.0.0.1:80" "200" "-" "-" TID_1234abcd5678ef90 "-" "-" "-"
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
https 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 10.0.0.1:80 0.086 0.048 0.037 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1" "curl/7.46.0" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337281-1d84f3d73c47ec4e58577259" "www.example.com" "arn:aws:acm:us-east-2:123456789012:certificate/12345678-1234-1234-1234-123456789012" 1 2018-07-02T22:22:48.364000Z "authenticate,forward" "-" "-" "10.0.0.1:80" "200" "-" "-" TID_1234abcd5678ef90
https 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 [fe80::202:b3ff:fe1e:8329]:443 [2001:db8::1]:80 0.086 0.048 0.037 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1" "curl/7.46.0" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337281-1d84f3d73c47ec4e58577259" "www.example.com" "arn:aws:acm:us-east-2:123456789012:certificate/12345678-1234-1234-1234-123456789012" 1 2018-07-02T22:22:48.364000Z "authenticate,forward" "-" "-" "10.0.0.1:80" "200" "-" "-" TID_1234abcd5678ef90
https 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 [fe80::202:b3ff:fe1e:8329]:443 [2001:db8::1]:80 0.086 0.048 0.037 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1" "curl/7.46.0" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337281-1d84f3d73c47ec4e58577259" "www.example.com" "arn:aws:acm:us-east-2:123456789012:certificate/12345678-1234-1234-1234-123456789012" 1 2018-07-02T22:22:48.364000Z "authenticate,forward" "-" "-" "10.0.0.1:80" "200" "-" "-" TID_1234abcd5678ef90
https 2018-07-02T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 10.0.0.1:80 0.086 0.048 0.037 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1" "curl/7.46.0" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 "Root=1-58337281-1d84f3d73c47ec4e58577259" "www.example.com" "arn:aws:acm:us-east-2:123456789012:certificate/12345678-1234-1234-1234-123456789012" 1 2018-07-02T22:22:48.364000Z "authenticate,forward" "-" "-" "10.0.0.1:80" "200" "-" "-" TID_1234abcd5678ef90 "transformed.example.com" "https://transformed.example.com/index.html" "TransformSuccess"
Loading
Loading