postfix-log-parser
postfix-log-parser copied to clipboard
If the log file includes "postfix start/stop" command result, the error occered.
$ 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
I have the same problem.
chchang@mx:~/postfix-log-parser_linux_amd64$ sudo cat /var/log/mail.log|./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(0xc0000c5bc8, 0xc0000cf000, 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(0xc000012780, 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(0xc000012780, 0xc0000101b0, 0x0, 0x0, 0xc000012780, 0xc0000101b0)
/Users/youyo/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000012780, 0xc000032750, 0xc00007cf50, 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
but I'm not sure about the "postfix start/stop" pattern. my mail.log has no such words.
chchang@mx:~/postfix-log-parser_linux_amd64$ sudo cat /var/log/mail.log|grep postfix-script
chchang@mx:~/postfix-log-parser_linux_amd64$
I run into the same problem. But mine also does not have "postfix start/stop" anywhere.
having same issue ; perhaps, you should have a look at this new repository : https://github.com/yo000/postfix-log-parser
having same issue ; perhaps, you should have a look at this new repository : https://github.com/yo000/postfix-log-parser
used this repository but it seems it converts the timestamp value to 0000 in the year field. Any idea what needs to be done for this'