Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use provided time instead of time.now in NewEventWithTime #20

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
*.iml
5 changes: 4 additions & 1 deletion splunk/v2/splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *Client) NewEvent(event interface{}, source string, sourcetype string, i
// the case, use this function to create the Event object and the the LogEvent function.
func (c *Client) NewEventWithTime(t time.Time, event interface{}, source string, sourcetype string, index string) *Event {
e := &Event{
Time: EventTime{time.Now()},
Time: EventTime{t},
Host: c.Hostname,
Source: source,
SourceType: sourcetype,
Expand Down Expand Up @@ -160,6 +160,9 @@ func (c *Client) doRequest(b *bytes.Buffer) error {
// make new request
url := c.URL
req, err := http.NewRequest("POST", url, b)
if err != nil {
return err
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Splunk "+c.Token)

Expand Down