Skip to content

Commit

Permalink
check if journald directory exists (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Sirianni authored Aug 16, 2021
1 parent 7f94b79 commit 69d0199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions operator/builtin/input/journald/journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"os"
"os/exec"
"strconv"
"sync"
Expand Down Expand Up @@ -68,6 +69,9 @@ func (c JournaldInputConfig) Build(buildContext operator.BuildContext) ([]operat

switch {
case c.Directory != nil:
if _, err := os.Stat(*c.Directory); os.IsNotExist(err) {
return nil, fmt.Errorf("invalid value '%s' for parameter 'directory', directory does not exist: %s", *c.Directory, err)
}
args = append(args, "--directory", *c.Directory)
case len(c.Files) > 0:
for _, file := range c.Files {
Expand Down

0 comments on commit 69d0199

Please sign in to comment.