https://github.com/jmervine/splunking
Low level lib to create an http Request object for connecting to Splunk.
https://github.com/jmervine/splunking
api authentication golang http splunk
Last synced: 4 months ago
JSON representation
Low level lib to create an http Request object for connecting to Splunk.
- Host: GitHub
- URL: https://github.com/jmervine/splunking
- Owner: jmervine
- Created: 2017-10-01T06:21:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-26T15:14:17.000Z (almost 5 years ago)
- Last Synced: 2025-08-31T21:38:57.090Z (5 months ago)
- Topics: api, authentication, golang, http, splunk
- Language: Go
- Homepage: https://godoc.org/github.com/jmervine/splunking
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Splunk Request
[](https://travis-ci.org/jmervine/splunking) [](https://godoc.org/github.com/jmervine/splunking)
Low level lib to create an http Request object for connecting to Splunk.
### Usage
```go
import (
"fmt"
"github.com/jmervine/splunking"
)
func main() {
// Load configs from environment
// SPLUNK_USERNAME=username
// SPLUNK_PASSWORD=password
// SPLUNK_HOST=splunk.example.com
// SPLUNK_PORT=8089 // default
// SPLUNK_PROTO=https // default
// SPLUNK_OUTPUT_TYPE=json // default
client, err := splunking.Init()
if err != nil {
panic(err)
}
// Or load from URL - same defaults as above apply
client, err = splunking.InitURL("https://username:password@splunk.example.com:8089?output_type=json")
if err != nil {
panic(err)
}
// Basic request
resp, err := client.Get("/api/path", nil)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", resp)
// Advanced request handling
req, err := client.Request("GET", "/api/path", nil)
if err != nil {
panic(err)
}
// ... do stuff with request
resp, err = client.Submit(req)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", resp)
}
```