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

add orig_to to logPattern (non-capturing) #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions bounce2db.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package main

import "log"
import "os"
import "flag"
import "./postfixutil"
import "encoding/json"
import "gopkg.in/mgo.v2"
import (
"encoding/json"
"flag"
"log"
"os"

"github.com/amnay-mo/postfix-bounce/postfixutil"
"gopkg.in/mgo.v2"
)

const (
BounceCollection string = "bounces"
Expand Down
18 changes: 9 additions & 9 deletions postfixutil/postfixutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import "time"
import "regexp"

const (
softDSN string = "5.2.0 5.2.1 5.2.2 5.3.1 5.4.5 5.5.3"
softDSN string = "5.2.0 5.2.1 5.2.2 5.3.1 5.4.5 5.5.3"
queueIDPattern string = "\\]:\\s([A-Z0-9]+):"
logPattern string = "^([A-Za-z]{3}\\s+\\d+ [0-9:]{8}) .*? .*?: ([A-Z0-9]+): to=<(.*?)>, relay=(.*?), delay=(.*?), delays=(.*?), dsn=(.*?), status=(.*?)$"
logPattern string = "^([A-Za-z]{3}\\s+\\d+ [0-9:]{8}) .*? .*?: ([A-Z0-9]+): to=<(.*?)>, (?:orig_to=<.*?>, )?relay=(.*?), delay=(.*?), delays=(.*?), dsn=(.*?), status=(.*?)$"
)

type Bounce struct {
// ID string
Date time.Time
Date time.Time
QueueID string
To string
Relay string
Delay string
Delays string
DSN string
Status string
To string
Relay string
Delay string
Delays string
DSN string
Status string
}

func (b *Bounce) IsHard() bool {
Expand Down