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

fixes panic appears when tailer is nil #54

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

k-kinzal
Copy link
Contributor

A go panic occurs when the log file specification is empty.
The problem is that Collect works when the tailer is nil.

$ /bin/postfix_exporter --postfix.logfile_path=
$ kc logs -c exporter postfix-daemon-kr7mp
2020/04/22 03:09:38 Reading log events from 
2020/04/22 03:09:38 Listening on :9154
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x841538]

goroutine 10 [running]:
main.(*PostfixExporter).CollectLogfileFromFile(0xc0000c4dc0, 0xa02c60, 0xc00002d080)
	/go/src/github.com/kumina/postfix_exporter/postfix_exporter.go:433 +0xe8
main.(*PostfixExporter).StartMetricCollection(0xc0000c4dc0, 0xa02c60, 0xc00002d080)
	/go/src/github.com/kumina/postfix_exporter/postfix_exporter.go:671 +0x112
created by main.main
	/go/src/github.com/kumina/postfix_exporter/main.go:69 +0xedb

@BartVerc
Copy link
Member

Thanks for the PR!

@BartVerc BartVerc merged commit 8e63fbb into kumina:master Jun 30, 2020
chas0amx pushed a commit to chas0amx/postfix_exporter that referenced this pull request Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants