Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beat panics if log directory cannot be created #2490

Closed
ruflin opened this issue Sep 8, 2016 · 0 comments
Closed

Beat panics if log directory cannot be created #2490

ruflin opened this issue Sep 8, 2016 · 0 comments

Comments

@ruflin
Copy link
Contributor

ruflin commented Sep 8, 2016

Version: master
Steps to reproduce:

  • Put log directory in logging.files.path: where directory cannot be created by filebeat (no permissions)
  • Start beat

Panic output

2016/09/08 11:09:48.485527 beat.go:285: CRIT Exiting: error initializing logging: mkdir /var/log/filebeat: permission denied
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa4108]

goroutine 1 [running]:
panic(0x4cc680, 0xc4200120b0)
        /usr/local/Cellar/go/1.7/libexec/src/runtime/panic.go:500 +0x1a1
github.com/elastic/beats/libbeat/logp.(*FileRotator).Rotate(0xc42016e4c0, 0xc420164930, 0xc4201648c0)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/logp/file_rotator.go:118 +0x48
github.com/elastic/beats/libbeat/logp.(*FileRotator).WriteLine(0xc42016e4c0, 0xc420164930, 0x6e, 0x70, 0x6e, 0x70)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/logp/file_rotator.go:64 +0x48
github.com/elastic/beats/libbeat/logp.send(0x4, 0x2, 0x56080a, 0x5, 0x566499, 0xb, 0xc42004bea8, 0x1, 0x1)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/logp/log.go:64 +0x1c0
github.com/elastic/beats/libbeat/logp.msg(0x2, 0x56080a, 0x5, 0x566499, 0xb, 0xc42004bea8, 0x1, 0x1)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/logp/log.go:84 +0x9d
github.com/elastic/beats/libbeat/logp.Critical(0x566499, 0xb, 0xc42004bea8, 0x1, 0x1)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/logp/log.go:101 +0x71
github.com/elastic/beats/libbeat/beat.handleError(0x7c5080, 0xc420174370, 0x7c5080, 0xc420174370)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/beat/beat.go:285 +0xb3
github.com/elastic/beats/libbeat/beat.Run(0x5643b0, 0x8, 0x0, 0x0, 0x5a97a8, 0xc42004bf90, 0xc4200001a0)
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/libbeat/beat/beat.go:133 +0x7d
main.main()
        /Users/ruflin/Dev/gopath/src/github.com/elastic/beats/filebeat/main.go:22 +0x57
ruflin added a commit to ruflin/beats that referenced this issue Sep 16, 2016
* Assigns log rotator only after successful creation. Otherwise panic can happen during shutdown if directory cannot be generated as it tries to log.

Closes elastic#2490
@tsg tsg closed this as completed in #2571 Sep 19, 2016
tsg pushed a commit that referenced this issue Sep 19, 2016
* Assigns log rotator only after successful creation. Otherwise panic can happen during shutdown if directory cannot be generated as it tries to log.

Closes #2490
tsg pushed a commit to tsg/beats that referenced this issue Sep 19, 2016
* Assigns log rotator only after successful creation. Otherwise panic can happen during shutdown if directory cannot be generated as it tries to log.

Closes elastic#2490
leweafan pushed a commit to leweafan/beats that referenced this issue Apr 28, 2023
* Assigns log rotator only after successful creation. Otherwise panic can happen during shutdown if directory cannot be generated as it tries to log.

Closes elastic#2490
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant