Skip to content

Commit

Permalink
in_kubernetes_events: fix sqldb cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Rudolph <[email protected]>
  • Loading branch information
cm-rudolph committed Jan 31, 2025
1 parent 4c4f8c0 commit 10753f1
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit 10753f1

Please sign in to comment.