# Fail to unpack the dns configuration: requires duration \< 1 accessing 'processors.0.dns.min\_ttl'

**URL:** <https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [September 13, 2020, 7:14pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453 "2020-09-13T19:14:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dddpaul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dddpaul/32/75487_2.png) [@dddpaul](https://discuss.elastic.co/u/dddpaul)\
**Post date:** [September 13, 2020, 7:14pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/1 "2020-09-13T19:14:04Z")

</div>

Hi.

Trying Packetbeat 7.x branch with enabled DNS processor and default config fails with

```auto
fail to unpack the dns configuration: requires duration < 1 accessing 'processors.0.dns.min_ttl'

```

Steps to reproduce:

1. Config file:

```auto
processors:
  - dns: ~

```

1. Run config test:

```auto
./packetbeat test config --strict.perms=false -c packetbeat.yml

```

Dirty workaround is to remove "validate: min=1" from [https://github.com/elastic/beats/blob/de26878df4a41bca46a10aa061fa2e8065f75abb/libbeat/processors/dns/config.go#L92](https://github.com/elastic/beats/blob/de26878df4a41bca46a10aa061fa2e8065f75abb/libbeat/processors/dns/config.go#L92).

It seems like some problem when parsing yaml into nested structures, see [https://github.com/elastic/beats/blob/de26878df4a41bca46a10aa061fa2e8065f75abb/libbeat/processors/dns/config.go#L32](https://github.com/elastic/beats/blob/de26878df4a41bca46a10aa061fa2e8065f75abb/libbeat/processors/dns/config.go#L32)

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [September 14, 2020, 8:23pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/2 "2020-09-14T20:23:15Z")

</div>

Hi @dddpaul, welcome to the Elastic community forums!

I believe you've found a bug — thanks for reporting it! I've put up a candidate bugfix here: [https://github.com/elastic/beats/pull/21085](https://github.com/elastic/beats/pull/21085).

Thanks,

Shaunak

---

<div class="post-metadata">

**Author:** ![dddpaul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dddpaul/32/75487_2.png) [@dddpaul](https://discuss.elastic.co/u/dddpaul)\
**Post date:** [September 15, 2020, 4:37pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/3 "2020-09-15T16:37:23Z")

</div>

Hi.

The problem is not the absense of default value but incorrect parsing into nested structure.  
For example, given configuration:

```auto
processors:
  - dns:
      type: reverse
      success_cache:
        min_ttl: 2000m

```

Results with default SuccessCache MinTTL (1m):

```auto
DEBUG	[processor.dns]	dns/dns.go:67	DNS processor config: {CacheConfig:{SuccessCache:{TTL:0s MinTTL:1m0s InitialCapacity:1000 MaxCapacity:10000} FailureCache:{TTL:1m0s MinTTL:1m0s InitialCapacity:1000 MaxCapacity:10000}} Nameservers:[] Timeout:500ms Type:reverse Action:append TagOnFailure:[] Fields:null Transport:udp reverseFlat:map[]}	{"instance_id": 1}

```

The point is that this piece of code (see [https://github.com/elastic/beats/blob/bf3eace181c6755a560ede1116bfc26fff0c954f/libbeat/processors/dns/config.go#L31](https://github.com/elastic/beats/blob/bf3eace181c6755a560ede1116bfc26fff0c954f/libbeat/processors/dns/config.go#L31)):

```auto
// Config defines the configuration options for the DNS processor.
type Config struct {
	CacheConfig
	Nameservers []string `config:"nameservers"`
	...
}

// CacheConfig defines the success and failure caching parameters.
type CacheConfig struct {
	SuccessCache CacheSettings `config:"success_cache"`
	FailureCache CacheSettings `config:"failure_cache"`
}

```

should work like:

```auto
// Config defines the configuration options for the DNS processor.
type Config struct {
	SuccessCache CacheSettings `config:"success_cache"`
	FailureCache CacheSettings `config:"failure_cache"`
	Nameservers []string `config:"nameservers"`
	...
}

```

But it doesn't.

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [September 15, 2020, 5:07pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/4 "2020-09-15T17:07:39Z")

</div>

Oh, sorry, I misunderstood! Unlike yesterday I don't have time today to immediately look into a fix so would you mind reporting this bug on GitHub please: [https://github.com/elastic/beats/issues/new?template=bug-report.md](https://github.com/elastic/beats/issues/new?template=bug-report.md)?

Thanks,

Shaunak

---

<div class="post-metadata">

**Author:** ![dddpaul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dddpaul/32/75487_2.png) [@dddpaul](https://discuss.elastic.co/u/dddpaul)\
**Post date:** [September 15, 2020, 6:03pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/5 "2020-09-15T18:03:29Z")

</div>

Done - [https://github.com/elastic/beats/issues/21103](https://github.com/elastic/beats/issues/21103)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 13, 2020, 8:03pm UTC](https://discuss.elastic.co/t/fail-to-unpack-the-dns-configuration-requires-duration-1-accessing-processors-0-dns-min-ttl/248453/6 "2020-10-13T20:03:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
