fluent / fluent/fluent-bit

network: Only the first nameserver in resolv.conf is ever used

Open
#5,298 14 comments 0 reactions 0 assignees View on GitHub
exempt-stale status: waiting-for-triage
Dominant language
C
Stars
8.1k
Forks
2k
Avg merge
4d 16h
Merged PRs (30d)
58

Description

## Bug Report

**Describe the bug**
Given two `nameserver` records in /etc/resolv.conf, fluent-bit doesn't appear to ever use the second record. In particular, when the first record is unavailable (connection refused), fluent-bit simply gives up and errors.

**To Reproduce**
- Configure two DNS servers in resolv.conf (say 127.0.0.1 and a real value)
- Shut down the first one
```
[2022/04/11 19:00:36] [ warn] [net] getaddrinfo(host='example.com', err=12): Timeout while contacting DNS servers
```

**Expected behavior**
I would expect the application to fail-over and attempt resolution against the second nameserver entry.

**Screenshots**
n/a

**Your Environment**

* Version used: 1.8.15 and 1.9.0
* Configuration:
```
[OUTPUT]
Name es
Match journal.*
Host elk.example.com
Port 443
Index logs-journal
Aws_Auth On
Aws_Region us-east-1
Tls On
```
* Environment name and version (e.g. Kubernetes? What version?): EC2 and ECS Fargate
* Server type and version: n/a
* Operating System and version: CentOS 7
* Filters and plugins: n/a

This has been observed in both the td-agent-bit packages (1.9.0) and the aws/aws-for-fluent-bit images (1.8.15).

**Additional context**
We set `127.0.0.1` as our instances have local caching daemons running (dnsmasq). Fluent-bit does not appear to gracefully failover the DNS if the primary resolver is offline or net yet started.

We've observed `v1.8.1` *does not* exhibit this behavior. I'm guessing this is the result of changes in `v1.8.5`, but I have not bisected the releases to verify only skimmed the release notes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.