Skip to content

in_kubernetes_events: fix sqldb cleanup #9894

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

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions plugins/in_kubernetes_events/kubernetes_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,14 +648,13 @@ static int k8s_events_cleanup_db(struct flb_input_instance *ins,
{
int ret;
struct k8s_events *ctx = (struct k8s_events *)in_context;
time_t retention_time_ago;
time_t now = (cfl_time_now() / 1000000000);
uint64_t retention_time_ago;

if (ctx->db == NULL) {
FLB_INPUT_RETURN(0);
}

retention_time_ago = now - (ctx->retention_time);
retention_time_ago = cfl_time_now() - (ctx->retention_time * 1000000000L);
sqlite3_bind_int64(ctx->stmt_delete_old_kubernetes_events,
1, (int64_t)retention_time_ago);
ret = sqlite3_step(ctx->stmt_delete_old_kubernetes_events);
Expand Down
Loading