10 /* xs_submit takes a file containing a single XonStat request and submits it
11 to the server URL specified */
13 var fn = flag.String("file", "xonstat.log", "Logfile from XonStat")
14 var url = flag.String("url", "http://localhost:6543/stats/submit", "XonStat submission URL")
17 body, err := ioutil.ReadFile(*fn)
19 fmt.Printf("Issue opening file %s\n", *fn)
22 contentlength := int64(len(body))
24 r := bytes.NewReader(body)
26 req, _ := http.NewRequest("POST", *url, r)
27 req.ContentLength = contentlength
28 res, _ := http.DefaultClient.Do(req)
29 defer res.Body.Close()
31 fmt.Printf("%s: %s\n", *fn, res.Status)