generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Draft code which can get a long xml but without the log sent by e2e tests. Need to investigate how to search the results. Opened the issue in splunk repo: splunk/docker-splunk#625
func validateTestLogsInSplunk(url string, token string, testLog string) {
// Use REST API to retrieve the logs. https://docs.splunk.com/Documentation/Splunk/9.1.1/RESTREF/RESTsearch#search.2Fjobs
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
searchQuery := "search *" // Get the latest of all the log events.
req, err := http.NewRequest("POST", fmt.Sprintf("%s/services/search/jobs", url), bytes.NewBufferString(searchQuery))
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("Authorization", fmt.Sprintf("Splunk %s", token)) // https://docs.splunk.com/Documentation/Splunk/9.1.1/Security/UseAuthTokens
resp, err := client.Do(req)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
fmt.Println(string(body))
}
Metadata
Metadata
Assignees
Labels
No labels