elastic / elastic/elastic-agent-libs

Remove global paths from logp file output

Open
#397 0 comments 0 reactions 1 assignee Claimed by @orestisfl View on GitHub
Team:Elastic-Agent-Data-Plane
Dominant language
Go
Stars
6
Forks
57
Avg merge
6d 7h
Merged PRs (30d)
3

Description

[`logp.makeFileOutput`](https://github.com/elastic/elastic-agent-libs/blob/3b9a0af/logp/core.go#L476-L503) resolves the log file path using `cfg.Paths.Resolve(paths.Logs, ...)`.

(some) Production callsites that configure file-based logging and are affected:

- [ ] **beats** — [`libbeat/cmd/instance/beat.go:799`](https://github.com/elastic/beats/blob/8f7210899f/libbeat/cmd/instance/beat.go#L799)
```go
configure.LoggingWithTypedOutputsLocal(b.Info.Beat, b.Config.Logging, b.Config.EventLogging, logp.TypeKey, logp.EventType)
```
- [ ] **apm-server** — [`internal/beatcmd/logging.go:68`](https://github.com/elastic/apm-server/blob/d044b9a92/internal/beatcmd/logging.go#L68)
```go
logp.Configure(logpConfig)
```
- [ ] **elastic-agent** — [`pkg/core/logger/logger.go:133`](https://github.com/elastic/elastic-agent/blob/8c43ad3338/pkg/core/logger/logger.go#L133)
```go
configure.LoggingWithTypedOutputs("", commonCfg, eventLoggercommonCfg, "log.type", "event", outputs...)
```
- [x] **elastic-agent** — [`internal/pkg/agent/cmd/watch.go:381`](https://github.com/elastic/elastic-agent/blob/5e3c865484/internal/pkg/agent/cmd/watch.go#L381)
```go
configure.LoggingWithOutputs("", libC, internal)
```

All reach `makeFileOutput` via the `createSink` → `createLogOutput` chain.

The most straightforward option is to add a path config option that callers need to use.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.