postfix-log-parser icon indicating copy to clipboard operation
postfix-log-parser copied to clipboard

If the log file includes "postfix start/stop" command result, the error occered.

Open nabedge opened this issue 5 years ago • 4 comments

$ cat tmp.log | grep postfix-script
2020-02-04T22:22:38.982008+09:00 myhost postfix/postfix-script[10925]: stopping the Postfix mail system
2020-02-04T22:22:39.253796+09:00 myhost postfix/postfix-script[11016]: starting the Postfix mail system
$ cat tmp.log | grep postfix-script | ./postfix-log-parser 
panic: runtime error: index out of range [1] with length 0

goroutine 1 [running]:
github.com/youyo/postfix-log-parser.(*PostfixLog).Parse(0xc0000d5bc8, 0xc0000df000, 0x67, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
     /Users/youyo/src/github.com/youyo/postfix-log-parser/postfix-log-parser.go:50 +0x7b6
github.com/youyo/postfix-log-parser/postfix-log-parser/cmd.NewCmdRoot.func1(0xc0000a2280, 0x768480, 0x0, 0x0)
     /Users/youyo/src/github.com/youyo/postfix-log-parser/postfix-log-parser/cmd/root.go:59 +0x262
github.com/spf13/cobra.(*Command).execute(0xc0000a2280, 0xc0000101b0, 0x0, 0x0, 0xc0000a2280, 0xc0000101b0)
     /Users/youyo/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000a2280, 0xc000042750, 0xc00008af50, 0x4055ff)
     /Users/youyo/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
     /Users/youyo/pkg/mod/github.com/spf13/[email protected]/command.go:800
github.com/youyo/postfix-log-parser/postfix-log-parser/cmd.Execute()
     /Users/youyo/src/github.com/youyo/postfix-log-parser/postfix-log-parser/cmd/execute.go:10 +0x6d
main.main()
     /Users/youyo/src/github.com/youyo/postfix-log-parser/postfix-log-parser/main.go:26 +0x20

nabedge avatar Feb 18 '20 03:02 nabedge