humio

package
v0.0.0-...-58d3da0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://cloud.humio.com"

Variables

This section is empty.

Functions

func EscapeFieldFilter

func EscapeFieldFilter(s string) string

Types

type BatchIngester

type BatchIngester struct {
	Period time.Duration
	Client *Client
	// contains filtered or unexported fields
}

func (*BatchIngester) AddEvent

func (b *BatchIngester) AddEvent(tags map[string]string, e Event)

func (*BatchIngester) Flush

func (i *BatchIngester) Flush(ctx context.Context) error

type Client

type Client struct {
	Client  *http.Client
	BaseURL string
	Token   string
}

A Client is a HTTP REST client for the humio APIs. You must at least initialize the Token field. Unless BaseURL is set, cloud.humio.com will be used.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request) (*http.Response, func(), error)

Do performs the given HTTP request but sets the Authorization header

func (*Client) GetBaseURL

func (c *Client) GetBaseURL() string

func (*Client) Query

func (c *Client) Query(ctx context.Context, repo string, q Q) (io.ReadCloser, error)

Query performs a query and returns the response body stream Use this for streaming responses, for smaller requests see QueryDecode Caller must .Close() the returned reader

func (*Client) QueryDecode

func (c *Client) QueryDecode(ctx context.Context, repo string, q Q, ret interface{}) error

QueryDecode perform a single query decodes the complete JSON response into "ret". Use this for smaller responses which can be decoded and held in memory. Caller must .Close() the returned reader. For streaming, see the Query method

func (*Client) QueryJobsSync

func (c *Client) QueryJobsSync(ctx context.Context, repo string, q Q) (io.ReadCloser, error)

QueryJobsSync performs a query as a job and returns the response body stream Use this for streaming responses, for smaller requests see QueryDecode Caller must .Close() the returned reader

type Event

type Event struct {
	Timestamp  IngestTime        `json:"timestamp"`
	Attributes map[string]string `json:"attributes"`
}

type IngestTime

type IngestTime struct {
	time.Time
}

func (IngestTime) MarshalJSON

func (t IngestTime) MarshalJSON() ([]byte, error)

type Q

type Q struct {
	QueryString string            `json:"queryString"`
	Start       *QueryTime        `json:"start,omitempty"`
	End         *QueryTime        `json:"end,omitempty"`
	Arguments   map[string]string `json:"arguments,omitempty"`
}

type QueryTime

type QueryTime struct {
	// contains filtered or unexported fields
}

QueryTime serializes relative or absolute times to the proper format for start/end times in for the humio search API. See the functions RelativeTime and AbsoluteTime

func AbsoluteTime

func AbsoluteTime(time time.Time) *QueryTime

AbsoluteTime returns a QueryTime struct for specifying a absolute start or end time from a go time.Time struct

func RelativeTime

func RelativeTime(time string) *QueryTime

RelativeTime returns a QueryTime struct for specifying a relative start or end time such as "1minute" or "24 hours". See https://docs.humio.com/appendix/relative-time-syntax/

func (QueryTime) MarshalJSON

func (t QueryTime) MarshalJSON() ([]byte, error)

func (*QueryTime) String

func (t *QueryTime) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL