diff --git a/main.go b/main.go index ca3b37c..e0e5f1b 100644 --- a/main.go +++ b/main.go @@ -38,6 +38,8 @@ func main() { syslogSocketPath := flag.String("syslogd-socket", "", "The socket to listen to syslog addresses") // dumpSocketPath := flag.String("dump-socket", "/run/buffer.sock", "The socket that user will connect to in order to receive logs") bufsize := flag.Int("buffer-size", 1000, "Number of messages to keep") + syslogAddr := flag.String("syslog-addr", "127.0.0.1:9514", "Address:port where to listen for syslog messages") + queryAddr := flag.String("query-addr", "127.0.0.1:9080", "Address:port where to bind the query service") flag.Parse() channel := make(chan format.LogParts) @@ -50,17 +52,16 @@ func main() { server.ListenUnixgram(*syslogSocketPath) fmt.Printf("Binding socket `%s` [syslog]\n", *syslogSocketPath) } else { - addr := "127.0.0.1:9514" - fmt.Printf("Binding address `%s` [syslog]\n", addr) - server.ListenUDP(addr) + fmt.Printf("Binding address `%s` [syslog]\n", *syslogAddr) + server.ListenUDP(*syslogAddr) } circbuf = ring.New(*bufsize) server.Boot() go syslogdHandler(channel) http.HandleFunc("/", httpHandler) - fmt.Printf("Binding address `%s` [http]\n", ":9080") - http.ListenAndServe(":9080", nil) + fmt.Printf("Binding address `%s` [http]\n", *queryAddr) + http.ListenAndServe(*queryAddr, nil) server.Wait() }