Skip to content

Add retry to VictoriaLogs data source #3654

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

thebondo
Copy link

@thebondo thebondo commented May 30, 2025

The current VictoriaLogs data source will exit if the data source goes away once a tail based connection has been established. This causes the whole crowdsec service to exit as well.

This update fixes the Tail method on the VictoriaLogs client so that it tries to reconnect with a backoff if the connection is lost.

Resolves #3653

thebondo added 5 commits May 16, 2025 15:22
If the original HTTP get for the tail endpoint is successful, but
then the connection is lost, no retry is done. I updated the Tail
method to also retry in this case.
Upon review, the added code was pretty different in the approach
used to keep retrying compared to the approach for the QueryRange
method. I updated the method to create a new doTail that has the
same style as doQueryRange and updated Tail to use it. This has
the following effects:

- doTail will keep trying after losing a connection
- the retry interval will grow (with an upper limit) and shrink
  (with a lower limit) as connections are made and broken
- the time in the request is updated to avoid overlapping with
  previous data that was returned (missing in the first fix)
Bringing in changes from master.
Keeping up with changes from origin
The use of the ticker was unnecessary. I updated doTail to use a backoff
interval with time.After.
Copy link

@thebondo: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

Copy link

@thebondo: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@thebondo
Copy link
Author

/kind fix
/area agent

@thebondo thebondo marked this pull request as ready for review May 30, 2025 13:54
@thebondo thebondo marked this pull request as draft May 30, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CrowdSec exits if the VictoriaLogs data source goes down temporarily
1 participant