Skip to content

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

Description

@nabedge
$ 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/cobra@v0.0.3/command.go:766 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000a2280, 0xc000042750, 0xc00008af50, 0x4055ff)
     /Users/youyo/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
     /Users/youyo/pkg/mod/github.com/spf13/cobra@v0.0.3/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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions