Skip to content

Commit

Permalink
Adds a default for failure_cache.min_ttl (#21085)
Browse files Browse the repository at this point in the history
* Adds a default for failure_cache.min_ttl

* Parse YAML as inline + fix default value

Fixes #21103

Co-authored-by: Adrian Serrano <adrisr83@gmail.com>
  • Loading branch information
ycombinator and adriansr authored Sep 28, 2020
1 parent 2b8fd7c commit ddfe085
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libbeat/processors/dns/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// Config defines the configuration options for the DNS processor.
type Config struct {
CacheConfig
CacheConfig `config:",inline"`
Nameservers []string `config:"nameservers"` // Required on Windows. /etc/resolv.conf is used if none are given.
Timeout time.Duration `conifg:"timeout"` // Per request timeout (with 2 nameservers the total timeout would be 2x).
Type string `config:"type" validate:"required"` // Reverse is the only supported type currently.
Expand Down Expand Up @@ -89,7 +89,7 @@ type CacheSettings struct {
TTL time.Duration `config:"ttl"`

// Minimum TTL value for successful DNS responses.
MinTTL time.Duration `config:"min_ttl" validate:"min=1"`
MinTTL time.Duration `config:"min_ttl" validate:"min=1ns"`

// Initial capacity. How much space is allocated at initialization.
InitialCapacity int `config:"capacity.initial" validate:"min=0"`
Expand Down Expand Up @@ -166,6 +166,7 @@ var defaultConfig = Config{
MaxCapacity: 10000,
},
FailureCache: CacheSettings{
MinTTL: time.Minute,
TTL: time.Minute,
InitialCapacity: 1000,
MaxCapacity: 10000,
Expand Down

0 comments on commit ddfe085

Please sign in to comment.