You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logs: teach the file tailer/fingerprinter to honor NoFollow
Add a NoFollow bool field to LogsConfig (never parsed from user config -
mapstructure/yaml/json "-") and wire it through every place that opens a log
file for tailing:
- FileOpener interface (pkg/logs/util/opener) gains OpenLogFileNoFollow,
implemented on Linux via privilegedlogsclient.OpenNoFollow and falling back
to a plain open on other platforms (symlink rejection is only meaningful
for /proc/<pid>/fd-derived paths, which are Linux-only).
- The file tailer (pkg/logs/tailers/file/tailer.go) routes every open site
(initial open, rotation re-open) through a new openLogFile() helper that
picks the no-follow variant based on Source.Config().NoFollow.
ReplaceSource refreshes this from the new source.
- The fingerprinter (fingerprint.go) does the same for its own open site.
- pkg/logs/launchers/container/tailerfactory/file.go propagates
source.Config.NoFollow into the docker/k8s FileSource constructors. This is
needed here (not deferred to a later change) because
TestLogsConfigFieldCoverage in that package's test file asserts every
LogsConfig field is either copied or explicitly excluded - it fails the
moment NoFollow exists as a field without being handled.
Nothing sets NoFollow=true yet in this PR - this is generic plumbing,
exercised only by tests that construct LogsConfig{NoFollow: true} explicitly.
The field is deliberately unreachable from real config parsing
(mapstructure/yaml/json "-"). The next (and final) PR in this stack sets
cfg.NoFollow = true in the AD scheduler specifically for names.ProcessLog
sources and switches process_log's file-readability check over to the
no-follow client call - that's what actually activates the protection this
PR builds the mechanism for.
Part of a stack towards DSCVR-475; split out of PR #51746 for easier review.
Depends on the privileged-logs NoFollow transport PR.
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Vincent Whitchurch <vincent.whitchurch@datadoghq.com>
0 commit comments