Skip to content

Commit

Permalink
spool to disk: more descriptive error message (#7338)
Browse files Browse the repository at this point in the history
When the file backing the queue.spool cannot be open or created, beats
fail with a rather vague error message:

  Exiting: error initializing publisher: invalid argument

This happens when the file resides in a filesystem that doesn't support
mmap, like a shared virtualbox directory.

Now it will output something a little bit more descriptive:

Exiting: error initializing publisher: spool queue: failed to open file
at path '/vagrant/src/github.com/elastic/beats/auditbeat/data/spool.dat':
invalid argument

(cherry picked from commit 0bfb541)
  • Loading branch information
adriansr authored and ruflin committed Jun 15, 2018
1 parent 0f58bfa commit 36411a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libbeat/publisher/queue/spool/spool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"sync"
"time"

"github.com/pkg/errors"

"github.com/elastic/beats/libbeat/common/atomic"
"github.com/elastic/beats/libbeat/publisher/queue"
"github.com/elastic/go-txfile"
Expand Down Expand Up @@ -86,7 +88,7 @@ func NewSpool(logger logger, path string, settings Settings) (*Spool, error) {

f, err := txfile.Open(path, mode, settings.File)
if err != nil {
return nil, err
return nil, errors.Wrapf(err, "spool queue: failed to open file at path '%s'", path)
}
defer ifNotOK(&ok, ignoreErr(f.Close))

Expand Down

0 comments on commit 36411a3

Please sign in to comment.