Skip to content

Commit

Permalink
[CENNSO-1852] Throttle ipfix error messages (#396)
Browse files Browse the repository at this point in the history
To avoid lags because of warnings spam
  • Loading branch information
mogaika authored Mar 15, 2024
1 parent adee5e3 commit e36bf4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions upf/upf_ipfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,10 @@ upf_ipfix_ensure_context (const upf_ipfix_context_key_t *key)
&context->template_id, key->is_ip4, true);
if (rv)
{
clib_warning ("couldn't add IPFIX report, perhaps "
"the exporter has been deleted?");
vlib_log_err (
fm->log_failure_class,
"IPFIX report add reason %U, exporter misconfigured or deleted",
format_vnet_api_errno, rv);
pool_put (fm->contexts, context);
return ~0;
}
Expand All @@ -718,6 +720,9 @@ upf_ipfix_init (vlib_main_t *vm)
/* Set up time reference pair */
fm->vlib_time_0 = (u32) vlib_time_now (vm);

fm->log_failure_class =
vlib_log_register_class_rate_limit ("ipfix", "failure", 1);

/* initialize the IP/TEID hash's */
clib_bihash_init_24_8 (&fm->context_by_key, "context_by_key",
UPF_IPFIX_MAPPING_BUCKETS,
Expand Down
2 changes: 2 additions & 0 deletions upf/upf_ipfix.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ typedef struct
u16 template_id;
u32 vlib_time_0;

vlib_log_class_t log_failure_class; // rate limited log class

/** convenience vlib_main_t pointer */
vlib_main_t *vlib_main;
} upf_ipfix_main_t;
Expand Down

0 comments on commit e36bf4a

Please sign in to comment.