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

[filebeat][gcs] - Refactor & cleanup with updates to some default values and docs #41834

Merged
merged 11 commits into from
Dec 3, 2024

Conversation

ShourieG
Copy link
Contributor

@ShourieG ShourieG commented Nov 29, 2024

Type of change

  • Cleanup
  • Docs

Proposed commit message

This PR is a successor to an older closed PR. The older PR has been split into two parts, this being the one containing the necessary refactor and updates to default values and docs.

Default values have been updated to be more in line with standard mode of operations.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
    - [] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@ShourieG ShourieG requested a review from a team as a code owner November 29, 2024 10:44
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 29, 2024
Copy link
Contributor

mergify bot commented Nov 29, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @ShourieG? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Nov 29, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Nov 29, 2024
@ShourieG ShourieG added the Team:Security-Service Integrations Security Service Integrations Team label Nov 29, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 29, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@ShourieG
Copy link
Contributor Author

/test

The input can be configured to work with and without polling, though currently, if polling is disabled it will only
perform a one time passthrough, list the file contents and end the process. Polling is generally recommented for most cases
even though it can get expensive with dealing with a very large number of files.
The input can be configured to work with and without polling, though if polling is disabled, it will only perform a one time passthrough, list the file contents and end the process.
Copy link
Contributor

Choose a reason for hiding this comment

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

"passthrough" is not right here. See here.

Copy link
Contributor

Choose a reason for hiding this comment

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

The semantics of omitempty don't make sense with this change. Actually, they don't make sense without this change (omitempty is always a serialisation option), and the string doesn't exist in go-ucfg. Why are they here?

The semantics change though even without this; for example, if poll is not set in the previous implementation the value here is whatever default is in place, but now an absent setting will be treated as false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@efd6, I've removed the omitempty tags from most places except one where it makes sense.

As for the default values, the defaultConfig() needed to be called before the unpack, which has been added. This will provide a baseline from things getting misconfigured.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. Can you fix the comment for tryOverrideOrDefault? It refers to absence in the global config which is no longer possible since none of the fields are pointer values anymore.

I'm also wondering about why TimeStampEpoch is a pointer. I imagine that this is to check that it has been set. This is checked for being between the unix epoch (0) and a point far in the future. Is the unix epoch not a good default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the initial philosophy behind timestamp epoch was that any value would mean that it had been set and that it would be up to the user to control the value.

Copy link
Contributor

Choose a reason for hiding this comment

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

How does that differ from, e.g. poll?

Copy link
Contributor Author

@ShourieG ShourieG Dec 3, 2024

Choose a reason for hiding this comment

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

Poll is now always set to true by default and we treat it as some value exists. So if poll is not set we would still set it. But in case of timestamp epoch if no value is set we won't trigger the timestamp check filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the comments

@ShourieG ShourieG merged commit 01cc134 into elastic:main Dec 3, 2024
20 of 22 checks passed
mergify bot pushed a commit that referenced this pull request Dec 3, 2024
ShourieG added a commit that referenced this pull request Dec 3, 2024
…ues and docs (#41834) (#41860)

(cherry picked from commit 01cc134)

Co-authored-by: ShourieG <[email protected]>
@ShourieG ShourieG deleted the gcs/refactor_cleanup branch December 3, 2024 09:13
@ShourieG ShourieG added the backport-8.17 Automated backport with mergify label Dec 11, 2024
mergify bot pushed a commit that referenced this pull request Dec 11, 2024
ShourieG added a commit that referenced this pull request Dec 11, 2024
…ates to some default values and docs (#41986)

* [filebeat][gcs] - Refactor & cleanup with updates to some default values and docs (#41834)

(cherry picked from commit 01cc134)

* Update CHANGELOG.next.asciidoc

---------

Co-authored-by: ShourieG <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify cleanup Filebeat Filebeat input:GCS refactoring Team:Security-Service Integrations Security Service Integrations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants