Skip to content

Commit 12d0f57

Browse files
committed
SCFF-29 the appender parses the event to a string, including timestamp
1 parent 5b11f87 commit 12d0f57

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

eventRouting/eventrouting.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (e *EventRouting) RouteEvent(msg *events.Envelope) {
7676
e.selectedEventsCount["ignored_app_message"]++
7777
} else {
7878
//Push the event to the queue
79+
fmt.Println("pushing event to queue")
7980
e.queue.Push(eventQueue.NewNode(*event))
8081
e.selectedEventsCount[eventType.String()]++
8182

main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ func main() {
4040

4141
fmt.Println("this is the sumo endpoint")
4242
fmt.Println(sumoEndpoint)
43+
4344
//Creating queue
44-
nozzleQueue := eventQueue.NewQueue(make([]*eventQueue.Node, 100))
45-
loggingClientSumo := sumoCFFirehose.NewSumoLogicAppender(*sumoEndpoint, 1000, *nozzleQueue)
45+
queue := eventQueue.NewQueue(make([]*eventQueue.Node, 100))
46+
loggingClientSumo := sumoCFFirehose.NewSumoLogicAppender(*sumoEndpoint, 1000, *queue)
4647

4748
fmt.Printf("Starting firehose-to-sumo %s \n", version)
4849

@@ -67,7 +68,7 @@ func main() {
6768
}
6869

6970
//Creating Events
70-
events := eventRouting.NewEventRouting(cachingClient, *loggingClientSumo, *nozzleQueue)
71+
events := eventRouting.NewEventRouting(cachingClient, *loggingClientSumo, *queue)
7172
err := events.SetupEventRouting(*wantedEvents)
7273
if err != nil {
7374
log.Fatal("Error setting up event routing: ", err)

sumoCFFirehose/sumoLogicAppender.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"time"
99

1010
"bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/eventQueue"
11-
//"bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/events"
1211
)
1312

1413
type SumoLogicAppender struct {
@@ -46,6 +45,7 @@ func (s *SumoLogicAppender) Connect() bool {
4645

4746
func (s *SumoLogicAppender) AppendLogs() {
4847
// the appender calls for the next message in the queue and parse it to a string
48+
fmt.Println("i'm in appendLogs")
4949
event := s.nozzleQueue.Pop().GetNodeEvent()
5050
/*
5151
if event == nil {
@@ -60,7 +60,7 @@ func (s *SumoLogicAppender) AppendLogs() {
6060
return
6161
}
6262

63-
Message := time.Unix(int64(event.Fields["timestamp"].(int64)), 0).String() + "\t" + event.Fields["message_type"].(string) + "\t" + event.Msg + "\n"
63+
Message := time.Unix(0, event.Fields["timestamp"].(int64)*int64(time.Nanosecond)).String() + "\t" + event.Fields["message_type"].(string) + "\t" + event.Msg + "\n"
6464
fmt.Println(Message)
6565
s.SendToSumo(Message)
6666
}

0 commit comments

Comments
 (0)