Skip to content
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

[exporter/awss3] Raw Log Setting #32679

Closed
blakeromano opened this issue Apr 24, 2024 · 11 comments
Closed

[exporter/awss3] Raw Log Setting #32679

blakeromano opened this issue Apr 24, 2024 · 11 comments
Labels

Comments

@blakeromano
Copy link
Contributor

Component(s)

exporter/awss3

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

In the Amazon Cloudwatch Exporter there is a configuration setting called raw_log which will take the OpenTelemetry format and significantly reduce the size of the JSON and do some processing to make logs easily queryable in CloudWatch logs. I'd love to see this be added to the S3 Exporter. When trying to then do an ingestion of the Logs in S3 into a service like OpenSearch the data in S3 is very hard to parse and process leading to pains when trying to query it. If the feature of raw_log was enabled for logs exported to S3 this would reduce the burden of engineers having to do transformations in Lambda, ETL jobs or OSI Pipelines.

Describe the solution you'd like

I would want the S3 Exporter to have a raw_log attribute defaulted to false that when enabled would emit the same logic the CloudWatch Exporter has to turn the logs into a unified struct before doing a PutObject to the JSON in S3. This should not impact anything on metrics or traces and should only impact logs.

Describe alternatives you've considered

There is ETL changes after the data is in S3 or some work that can be done via operators in the log receiver used that could be done in place of this however this solution would be much simpler do in the Exporter.

Additional context

The code the Cloudwatch Log Exporter does when raw_log is set to true lives here https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/awscloudwatchlogsexporter/exporter.go#L208-L239

@blakeromano blakeromano added enhancement New feature or request needs triage New item requiring triage labels Apr 24, 2024
@blakeromano blakeromano changed the title Raw Log [exporter/awss3] Raw Log Setting Apr 24, 2024
Copy link
Contributor

Pinging code owners:

%s See Adding Labels via Comments if you do not have permissions to add labels yourself.

@blakeromano
Copy link
Contributor Author

blakeromano commented Apr 25, 2024

I looked at the awss3 exporter code more and think this could be accomplished with a new marshaler. Something maybe like prettyJSON or something along those lines. Or logMarshaler maybe?

@atoulme
Copy link
Contributor

atoulme commented Apr 25, 2024

You can do that using the encoding config field, https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/awss3exporter/README.md?plain=1#L31

You can use of one of the encoding extensions under extensions/encoding or come up with your own.

@atoulme atoulme removed the needs triage New item requiring triage label Apr 25, 2024
@blakeromano
Copy link
Contributor Author

@atoulme that seems to me that none of the encoding extensions have been added to the contrib distribution yet so unfortunately I don't think that will totally get me what I want. I am happy to contribute a new encoder however it doesn't quite seem that encoding is in any distribution yet.

@atoulme
Copy link
Contributor

atoulme commented Apr 26, 2024

We can fix that, for sure. Do you want to file issues to make it so?

@blakeromano
Copy link
Contributor Author

When you mean "fix that" are you referring to none of the encoding extensions in the contrib distribution or are you referring to adding a new encoder?

@atoulme
Copy link
Contributor

atoulme commented Apr 26, 2024

Both I guess. That said I'm working on making the text_encoding encoder marshal logs so it just writes the body.

@atoulme
Copy link
Contributor

atoulme commented Apr 26, 2024

Here, would you like to review #32696 ?

@blakeromano
Copy link
Contributor Author

I have a starting PR here -> #32722 to add some logic into jsonlogencoding extension which I think is the best spot for this

andrzej-stencel pushed a commit that referenced this issue May 7, 2024
**Description:** <!--Ex. Fixing a bug - Describe the bug and how this
fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->

The goal of this PR is to add configuration to the JSON Encoding method
to have metadata from resources and attributes in logs and output those
into a json attribute. This also will output the body of the log in the
`body` attribute. This follows a similar pattern that the AWS Cloudwatch
Log Exporter uses but removes any of the AWS specific logic and makes
this a more generalized solution

**Link to tracking Issue:** <Issue number if applicable>
#32679

**Testing:** <Describe what testing was performed and which tests were
added.> Unit Tests were added to validate that the output is desired and
that the existing logic remains the same.

**Documentation:** <Describe the documentation added.> Documentation
regarding the usage of the configuration as well as the output to expect
is added.

---------

Signed-off-by: Blake R <[email protected]>
andrzej-stencel pushed a commit that referenced this issue May 15, 2024
… with separators (#32696)

**Description:** 
Add support for text marshaling/unmarshaling with separators

**Link to tracking Issue:**
#32679

**Testing:**
Unit tests.

**Documentation:**
README
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Jun 26, 2024
@blakeromano
Copy link
Contributor Author

This is fixed now 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants