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

Upload batches of records to S3 instead of writing to file; Upgrade input validation using Go validator package. #4

Merged
merged 32 commits into from
Jul 4, 2024

Conversation

davemarco
Copy link
Contributor

@davemarco davemarco commented Jun 27, 2024

Description

Plugin can now send chunks to aws s3. In addition, the input validation has been heavily upgraded. Now supports default settings, optional settings, and input parsing. I also cleaned up READMEs and added a table for settings and defaults.

AWS S3

Plugin loads credentials using standard hierarchy described here

In addition to standard chain, I added the ability to assume a role. The fluent bit s3 plugin can do this, and I was already familiar with roles for clp cloud, so i added this feature.

I added some checks during startup to make sure credentials are good, and bucket exists . If checks fail, wont start collecting logs and will exit.

The file name is as follows: $bucketPrefix/$tag_$time_$ID.zst
The time is the system time in nanoseconds. the ID can be set by user, but if they leave it out, it is a UUID. This should help prevent collision if multiple collectors are sending to same path.

I removed file stuff, but may add back as another plugin later. In general, I think it is just useful for debugging and not having to send stuff to s3.

Input validation

Using go validator package to help with input validation. Fancier features being used are timezone and string parsing. Timezone checks if the IR timezone is a valid timezone. String parsing is being used to confirm role_arn has the correct prefix. More can be added later on.

There were some issues in that fluent-bit only supplies string type, and does not supply boolean type. Some of the code is confusing because of this, let me know if questions.

Validation performed

  • Sent logs to test bucket using regular setup and docker.
  • Tested role_arn (assume IAM role) setting works as expected with a test role.
  • Tested startup checks with invalid credentials/buckets

@davemarco davemarco requested a review from davidlion June 27, 2024 21:30
@davemarco davemarco requested a review from davidlion July 2, 2024 15:01
@davemarco davemarco changed the title Upload batch of records to s3 instead of writing to file. Upgrade input validation using go validator package. Upload batch of records to S3 instead of writing to file. Upgrade input validation using Go validator package. Jul 3, 2024
@kirkrodrigues kirkrodrigues changed the title Upload batch of records to S3 instead of writing to file. Upgrade input validation using Go validator package. Upload batches of records to S3 instead of writing to file. Upgrade input validation using Go validator package. Jul 3, 2024
kirkrodrigues
kirkrodrigues previously approved these changes Jul 3, 2024
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on behalf of @davidlion.

kirkrodrigues
kirkrodrigues previously approved these changes Jul 4, 2024
davidlion
davidlion previously approved these changes Jul 4, 2024
@davidlion davidlion changed the title Upload batches of records to S3 instead of writing to file. Upgrade input validation using Go validator package. Upload batches of records to S3 instead of writing to file; Upgrade input validation using Go validator package. Jul 4, 2024
@davidlion davidlion merged commit 7c3ce5f into y-scope:main Jul 4, 2024
2 checks passed
davemarco added a commit to davemarco/fluent-bit-clp-fork that referenced this pull request Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants