Skip to content

Commit

Permalink
loki.source.journald: sync positions directory permissions (#3973)
Browse files Browse the repository at this point in the history
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
  • Loading branch information
tpaschalis authored and clayton-cornell committed Aug 14, 2023
1 parent 6e32a94 commit 5f5a27a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ Main (unreleased)

- Fix issue in operator where any version update will restart all agent pods simultaneously. (@captncraig)

- Fix an issue where `loki.source.journald` did not create the positions
directory with the appropriate permissions. (@tpaschalis)

### Other changes

- Add metrics when clustering mode is enabled. (@rfratto)
Expand Down
10 changes: 6 additions & 4 deletions component/loki/source/journal/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ type Component struct {

// New creates a new component.
func New(o component.Options, args Arguments) (component.Component, error) {
err := os.MkdirAll(o.DataPath, 0750)
if err != nil {
return nil, err
}

positionsFile, err := positions.New(o.Logger, positions.Config{
SyncPeriod: 10 * time.Second,
PositionsFile: filepath.Join(o.DataPath, "positions.yml"),
Expand All @@ -54,10 +59,7 @@ func New(o component.Options, args Arguments) (component.Component, error) {
if err != nil {
return nil, err
}
err = os.MkdirAll(o.DataPath, 0644)
if err != nil {
return nil, err
}

c := &Component{
metrics: target.NewMetrics(o.Registerer),
o: o,
Expand Down

0 comments on commit 5f5a27a

Please sign in to comment.