-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (25 loc) · 787 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
log "github.com/sirupsen/logrus"
"github.com/younisshah/gelffy/service"
"github.com/younisshah/gelffy/upload"
"github.com/younisshah/gelffy/listener"
"os"
)
const GelfPort = "12123"
func main() {
customerToken := os.Getenv("LOGGLY_CUSTOMER_TOKEN")
if len(customerToken) == 0 {
log.Errorln("failed to read Loggly customer token")
log.Fatalln("make sure to specify the token as an ENV variable")
}
log.Infoln("starting gelffy server on port: " + GelfPort)
udpConn := service.StartUDPServer(GelfPort)
defer udpConn.Close()
logChan := make(chan []byte)
forever := make(chan struct{})
go upload.StartUpload(customerToken, logChan)
go listener.ListenForLogs(udpConn, logChan)
log.Infoln("gelffy server started")
<-forever // run forever
}