Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Louizia, Rhoubin's committed Mar 31, 2017
1 parent ba7a801 commit fc02470
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions journald2graylog.go
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ var (
graylogHostname = kingpin.Flag("hostname", "Hostname or IP of your Graylog server, it has no default and MUST be specified").Envar("J2G_HOSTNAME").Required().String()
graylogPort = kingpin.Flag("port", "Port of the UDP GELF input of the Graylog server").Default("12201").Envar("J2G_PORT").Int()
graylogPacketSize = kingpin.Flag("packet-size", "Maximum size of the TCP/IP packets you can use between the source (journald2graylg) and the destination (your Graylog server)").Default("1420").Envar("J2G_PACKET_SIZE").Int()
maxRetryConnectionDurationInMin = kingpin.Flag("maxRetryConnectionDurationInMin", "Max Fail connection retrial duration").Default("2").Envar("J2G_MAXRETRYCONNECTION").Int()
maxRetryConnectionDurationInMin = kingpin.Flag("max-retry-time", "Max Fail connection retrial duration").Default("2").Envar("J2G_MAX_RETRY_TIME").Int()
)

func main() {
@@ -54,17 +54,17 @@ func main() {

timeexec := time.Since(timenow)

if err != nil && timeexec > (time.Duration(*maxRetryConnectionDurationInMin)*time.Minute) {

syscall.Exit(1)
}
if err != nil {
d := be.Duration()
fmt.Printf("%s, reconnecting in %s ", err, d)
time.Sleep(d)
} else if err == nil {
if err == nil {
break
}
if timeexec > (time.Duration(*maxRetryConnectionDurationInMin)*time.Minute) {
syscall.Exit(1)
}

d := be.Duration()
fmt.Printf("%s, reconnecting in %s ", err, d)
time.Sleep(d)

}
// Determine what will be the default value of the "hostname" field in the
// GELF payload.

0 comments on commit fc02470

Please # to comment.