mirror of https://github.com/grafana/loki
[new] promtail: add readline rate limit (#5031)
* [new] promtail: add readline rate limit * [new] promtail: add readline rate limit #5031 * [new] promtail: add readline rate limit #5031 * [new] promtail: add readline rate limit #5031 * [new] promtail: add readline rate limit #5031 * Update clients/pkg/promtail/limit/config.go Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com> * Update clients/pkg/promtail/limit/config.go Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com> Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com>pull/4925/head
parent
9a7f5a22f6
commit
6b377b40d5
@ -0,0 +1,22 @@ |
||||
server: |
||||
http_listen_port: 9080 |
||||
grpc_listen_port: 0 |
||||
|
||||
positions: |
||||
filename: /tmp/positions.yaml |
||||
|
||||
clients: |
||||
- url: http://localhost:3100/loki/api/v1/push |
||||
|
||||
scrape_configs: |
||||
- job_name: system |
||||
static_configs: |
||||
- targets: |
||||
- localhost |
||||
labels: |
||||
job: varlogs |
||||
__path__: /var/log/*log |
||||
|
||||
limit_config: |
||||
readline_rate: 100 |
||||
readline_burst: 200 |
@ -0,0 +1,19 @@ |
||||
package limit |
||||
|
||||
import ( |
||||
"flag" |
||||
) |
||||
|
||||
type Config struct { |
||||
ReadlineRate float64 `yaml:"readline_rate" json:"readline_rate"` |
||||
ReadlineBurst int `yaml:"readline_burst" json:"readline_burst"` |
||||
ReadlineRateEnabled bool `yaml:"readline_rate_enabled,omitempty" json:"readline_rate_enabled"` |
||||
ReadlineRateDrop bool `yaml:"readline_rate_drop,omitempty" json:"readline_rate_drop"` |
||||
} |
||||
|
||||
func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { |
||||
f.Float64Var(&cfg.ReadlineRate, prefix+"limit.readline-rate", 10000, "promtail readline Rate.") |
||||
f.IntVar(&cfg.ReadlineBurst, prefix+"limit.readline-burst", 10000, "promtail readline Burst.") |
||||
f.BoolVar(&cfg.ReadlineRateEnabled, prefix+"limit.readline-rate-enabled", false, "Set to false to disable readline rate limit.") |
||||
f.BoolVar(&cfg.ReadlineRateDrop, prefix+"limit.readline-rate-drop", true, "Set to true to drop log when rate limit.") |
||||
} |
Loading…
Reference in new issue