Skip to content

Commit b0e9575

Browse files
committed
SCFF-7 compressing the log data before sending to sumo, using Gzip
1 parent 6824abc commit b0e9575

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sumoCFFirehose/sumoLogicAppender.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package sumoCFFirehose
22

33
import (
44
"bytes"
5+
"compress/gzip"
56
"net/http"
67
"runtime"
78
"time"
@@ -113,12 +114,17 @@ func (s *SumoLogicAppender) AppendLogs(buffer *SumoBuffer) {
113114
}
114115

115116
func (s *SumoLogicAppender) SendToSumo(buffer *SumoBuffer) {
117+
var buf bytes.Buffer
118+
g := gzip.NewWriter(&buf)
119+
g.Write(buffer.logStringToSend.Bytes())
120+
g.Close()
121+
116122
for time.Since(s.timerBetweenPost) < s.sumoPostMinimumDelay {
117123
logging.Trace.Println("Delaying post to honor minimum post delay")
118124
time.Sleep(100 * time.Millisecond)
119125
}
120126

121-
logging.Info.Println("Sending logs to Sumologic...")
127+
logging.Info.Println("Sending logs to Sumo Logic...")
122128
request, err := http.NewRequest("POST", s.url, buffer.logStringToSend)
123129
if err != nil {
124130
logging.Error.Printf("http.NewRequest() error: %v\n", err)

0 commit comments

Comments
 (0)