Log suppress feature is not honoring the log_suppress_interval setting
- Dominant language
- C
- Stars
- 8.1k
- Forks
- 2k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 71
Description
## Bug Report
**Describe the bug**
The log suppress feature is not honoring the `log_suppress_interval` setting. Instead, it uses the `cache->timeout`, which is a fixed value of 10 (see description below).
The suspicion was also reported [here](https://github.com/fluent/fluent-bit/pull/6435#issuecomment-1371621189)
**To Reproduce**
Run Fluent Bit with the following config.
fluent-bit.conf
```text
[SERVICE]
flush 1
[INPUT]
name dummy
[OUTPUT]
Name http
Match *
host localhost
port 1234
log_suppress_interval 15
workers 1
```
The `workers 1` is intended to reduce the verbosity. The log suppression feature seems to be per worker.
**Expected behavior**
It should honor the setting in the `log_suppress_interval` setting.
**Screenshots**
**Your Environment**
* Version used: master branch
* Configuration: provided above
* Environment name and version (e.g. Kubernetes? What version?):
* Server type and version:
* Operating System and version:
* Filters and plugins:
**Additional context**
The repro above will show these error messages (other lines suppressed for clarity):
```text
[2023/03/22 17:06:58] [error] [output:http:http.0] no upstream connections available to localhost:1234
...
[2023/03/22 17:07:08] [error] [output:http:http.0] no upstream connections available to localhost:1234
```
Those lines are 10 seconds apart instead of 15, as configured in the config file. This is where the check is done:
https://github.com/fluent/fluent-bit/blob/2226fd6c524529f9d2774fa53dde6bc74c86f5c3/src/flb_log.c#L295
That line compares timestamp + cache timeout with the current timestamp. However, the cache timeout is a fixed value of 10, as seen in the code below:
https://github.com/fluent/fluent-bit/blob/2226fd6c524529f9d2774fa53dde6bc74c86f5c3/src/flb_log.c#L330
This is why it always repeats the message after 10 seconds instead of the value in `log_suppress_interval`.
The fix should be to set this cache timeout to the value of `log_suppress_interval`, unless other changes are required, like making this setting part of the log worker context or the flb_log structure.
Contributor guide
Assessment
This issue has not been assessed yet.