-
Notifications
You must be signed in to change notification settings - Fork 3k
Support AWS ELB Access logs #41185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
edmocosta
merged 22 commits into
open-telemetry:main
from
MichaelKatsoulis:elb-access-logs
Aug 5, 2025
Merged
Support AWS ELB Access logs #41185
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
af144e8
elb-access-log initial commit
MichaelKatsoulis 13e5bda
Update tests
MichaelKatsoulis 462e554
make fmt
MichaelKatsoulis b0d8f15
Update extension/encoding/awslogsencodingextension/extension.go
MichaelKatsoulis b70ce1c
Review updates
MichaelKatsoulis 21402f8
Update extension/encoding/awslogsencodingextension/internal/unmarshal…
MichaelKatsoulis ea1e31a
Merge branch 'elb-access-logs' of github.com:MichaelKatsoulis/opentel…
MichaelKatsoulis f2adb1c
Update documentation of fields
MichaelKatsoulis 3685de5
Merge branch 'main' into elb-access-logs
MichaelKatsoulis 70b6deb
Add missing tests
MichaelKatsoulis a1c9283
Merge branch 'main' into elb-access-logs
MichaelKatsoulis eeee5ae
Merge remote-tracking branch 'upstream/main' into elb-access-logs
MichaelKatsoulis cdf6ea5
Run make goporto
MichaelKatsoulis 763db4c
Fix compiler error and add changelog
MichaelKatsoulis 758c43b
Merge branch 'main' into elb-access-logs
MichaelKatsoulis 7cf4e13
Fix linter errors
MichaelKatsoulis ddf1bd9
Merge branch 'elb-access-logs' of github.com:MichaelKatsoulis/opentel…
MichaelKatsoulis 1972e4d
Get rid of variable shadowing issue
MichaelKatsoulis 63340cc
Merge branch 'main' into elb-access-logs
MichaelKatsoulis cfb90b5
Merge branch 'main' into elb-access-logs
edmocosta d53c5f6
make nlb, clb and alb acronyms uppercase
MichaelKatsoulis 932d281
Merge branch 'main' into elb-access-logs
edmocosta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...n/encoding/awslogsencodingextension/internal/unmarshaler/elb-access-log/benchmark_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package elbaccesslogs | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"go.opentelemetry.io/collector/component" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type elbBenchmarkCase struct { | ||
name string | ||
filename string | ||
nLogs int | ||
} | ||
|
||
var elbCases = []elbBenchmarkCase{ | ||
{"ALB_1_log", "./testdata/alb_al_valid_logs.log", 1}, | ||
{"ALB_1000_logs", "./testdata/alb_al_valid_logs.log", 1_000}, | ||
{"CLB_1_log", "./testdata/clb_al_valid_logs.log", 1}, | ||
{"CLB_1000_logs", "./testdata/clb_al_valid_logs.log", 1_000}, | ||
{"NLB_1_log", "./testdata/nlb_al_valid_logs.log", 1}, | ||
{"NLB_1000_logs", "./testdata/nlb_al_valid_logs.log", 1_000}, | ||
} | ||
|
||
// createELBAccessLogContent reads data from a given elb log file | ||
// to get a valid log line. It will add this log line to a byte array | ||
// and append this line as many times as it takes to reach the desire | ||
// number of logs defined in nLogs. Each log record is defined in one | ||
// line. A new line means a new log record. | ||
func createELBAccessLogContent(b *testing.B, filename string, nLogs int) []byte { | ||
// get a log line from the testdata | ||
data, err := os.ReadFile(filename) | ||
require.NoError(b, err) | ||
|
||
size := len(data) + 1 // + "\n" | ||
buf := bytes.NewBuffer(make([]byte, 0, nLogs*size)) | ||
for i := 0; i < nLogs; i++ { | ||
buf.Write(data) | ||
if i != nLogs-1 { | ||
buf.Write([]byte("\n")) | ||
} | ||
} | ||
|
||
return buf.Bytes() | ||
} | ||
|
||
func BenchmarkUnmarshalAWSLogs(b *testing.B) { | ||
u := &elbAccessLogUnmarshaler{ | ||
buildInfo: component.BuildInfo{}, | ||
logger: zap.NewNop(), | ||
} | ||
for _, bc := range elbCases { | ||
data := createELBAccessLogContent(b, bc.filename, bc.nLogs) | ||
b.Run(bc.name, func(b *testing.B) { | ||
b.ReportAllocs() | ||
for i := 0; i < b.N; i++ { | ||
_, _ = u.UnmarshalAWSLogs(bytes.NewReader(data)) | ||
MichaelKatsoulis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more fields in ELB access logs that are not mentioned below. Seems we're dropping them at the moment. Can you please add a list of the fields that are not translated, and mention that they're TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the documentation!