-
Notifications
You must be signed in to change notification settings - Fork 10
/
constant.go
70 lines (53 loc) · 2.02 KB
/
constant.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package coralogix
import (
"bufio"
"net/http"
"net/textproto"
"strings"
"time"
)
const (
// MaxLogBufferSize is maximum log buffer size (default=128MiB)
MaxLogBufferSize uint64 = 128 * (1024 * 1024)
// MaxLogChunkSize is maximum chunk size (default=1.5MiB)
MaxLogChunkSize uint64 = 1.5 * (1024 * 1024)
// NormalSendSpeedInterval is a bulk send interval in normal mode
NormalSendSpeedInterval = 1 * time.Second
// FastSendSpeedInterval is a bulk send interval in fast mode
FastSendSpeedInterval = 500 * time.Millisecond
// TimeDelayTimeout is a timeout for time-delay request
TimeDelayTimeout uint = 5
// FailedPrivateKey is a default private key
FailedPrivateKey string = "no private key"
// NoAppName is a default application name
NoAppName string = "NO_APP_NAME"
// NoSubSystem is a default subsystem name
NoSubSystem string = "NO_SUB_NAME"
// HTTPTimeout is a default HTTP timeout
HTTPTimeout uint = 30
// HTTPSendRetryCount is a number of attempts to retry HTTP request
HTTPSendRetryCount uint = 5
// HTTPSendRetryInterval is a interval between failed http post requests
HTTPSendRetryInterval uint = 2
// LogCategory is a default category for log record
LogCategory string = "CORALOGIX"
// SyncTimeUpdateInterval is a time synchronization interval (in minutes)
SyncTimeUpdateInterval uint = 5
)
var (
// LogURL is the Coralogix logs url endpoint
LogURL string = GetEnv("CORALOGIX_LOG_URL", "https://api.coralogix.com:443/api/v1/logs")
// TimeDeltaURL is the Coralogix time delay url endpoint
TimeDeltaURL string = GetEnv("CORALOGIX_TIME_DELTA_URL", "https://api.coralogix.com:443/sdk/v1/time")
// Headers is the list of headers added to each send logs request
Headers http.Header = func() http.Header {
headers := GetEnv("CORALOGIX_HEADERS", "")
tp := textproto.NewReader(bufio.NewReader(strings.NewReader(headers)))
mimeHeader, err := tp.ReadMIMEHeader()
if err != nil {
mimeHeader = map[string][]string{}
}
mimeHeader.Set("Content-Type", "application/json")
return http.Header(mimeHeader)
}()
)