This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func postJson(url string, jsonStr []byte) { | |
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) | |
req.Header.Set("X-Custom-Header", "myvalue") | |
req.Header.Set("Content-Type", "application/json") | |
client := &http.Client{} | |
resp, err := client.Do(req) | |
if err != nil { | |
panic(err) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func randomInt(min int, max int) int { | |
// min and max inclusive | |
// assumes Seed has been set once for the program | |
// use something like rand.Seed(time.Now().UTC().UnixNano()) | |
return min + rand.Intn(max-min+1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func epoch() int64 { | |
return time.Now().Unix() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logstash filter to remove embedded NULL characters | |
filter { | |
mutate { | |
gsub => [ | |
# Replace all NULL characters empty string. Do this to the message field first which will apply to all fields instead of specifying individual fields. | |
"message", "[\u0000]", "" | |
] | |
} |