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

lambda-promtail: Add support for WAF logs in S3 #10416

Merged
merged 11 commits into from Sep 6, 2023

Conversation

lpugoy
Copy link
Contributor

@lpugoy lpugoy commented Sep 1, 2023

What this PR does / why we need it:
Adds support for WAF logs in S3 in lambda-promtail

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
    • If the change is worth mentioning in the release notes, add add-to-release-notes label
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR

@lpugoy lpugoy requested a review from a team as a code owner September 1, 2023 04:20
@CLAassistant
Copy link

CLAassistant commented Sep 1, 2023

CLA assistant check
All committers have signed the CLA.

@lpugoy lpugoy force-pushed the lambda_promtail_add_support_waf_logs branch from ee38354 to 77011d1 Compare September 1, 2023 04:21
@lpugoy
Copy link
Contributor Author

lpugoy commented Sep 1, 2023

Used #8254 as a guide which was unfortunately closed without merging.

@lpugoy
Copy link
Contributor Author

lpugoy commented Sep 3, 2023

@cstyan Thank you for your comments, added commits to address them.


fractionalSec := float64(i % sec)
if fractionalSec == 0 {
return sec, 0, err
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to set an actual value for err here? otherwise it has the nil value from strconv.ParseInt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, err would be nil if fractionalSec is 0. There would only be an error during parsing, fractionalSec being 0 just means that the Unix time only has seconds resolution. It is not an error.

@@ -652,64 +682,71 @@ func TestProcessSQSEvent(t *testing.T) {
require.True(t, handlerCalled)
}

func TestToMicroseconds(t *testing.T) {
func TestGetUnixSecNsec(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this test needs a case for the fractionalSec == 0 case as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests fractionalSec == 0.

Copy link
Contributor

@cstyan cstyan left a comment

Choose a reason for hiding this comment

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

just need to update based on main one last time I think

@lpugoy
Copy link
Contributor Author

lpugoy commented Sep 6, 2023

Sorry, just saw a typo in the test; it was referring to the old function name. Pushed a fix.

@cstyan cstyan merged commit 965f19a into grafana:main Sep 6, 2023
4 checks passed
@lpugoy lpugoy deleted the lambda_promtail_add_support_waf_logs branch September 6, 2023 22:29
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
**What this PR does / why we need it**:
Adds support for WAF logs in S3 in lambda-promtail

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [x] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [x] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [x] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [x] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](grafana@d10549e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants