Help us shape the future of Go! Take the 2026 Go Developer Survey

logs

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 8 Imported by: 3

README

Go client for Apex Logs.

Example

Error handling is omitted for brevity.

c := logs.Client{
  URL: "<ENDPOINT>",
  AuthToken: "<TOKEN>",
}

res, _ := c.GetProjects()

for _, project := range res.Projects {
  stats, _ := c.GetProjectStats(logs.GetProjectStatsInput{
    ProjectID: project.ID,
  })

  fmt.Printf("%s has %d logs\n", project.Name, stats.EventsTotal)
}

Resources

To learn more about Apex Logs visit the documentation, and to contribute to this client visit the github.com/apex/rpc project which is used to generate this client.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidScheme = errors.New("Client.URL must be HTTPS, not HTTP")

ErrInvalidScheme is returned when HTTP is used instead of HTTPS.

Functions

This section is empty.

Types

type AddAlertInput

type AddAlertInput struct {
	// Alert is the alert. This field is required.
	Alert Alert `json:"alert"`
}

AddAlertInput params.

type AddAlertOutput

type AddAlertOutput struct {
	// ID is the alert id. This field is required.
	ID string `json:"id"`
}

AddAlertOutput params.

type AddEventsInput

type AddEventsInput struct {
	// Events is the batch of events. This field is required.
	Events []Event `json:"events"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

AddEventsInput params.

type AddNotificationInput

type AddNotificationInput struct {
	// Notification is the notification. This field is required.
	Notification Notification `json:"notification"`
}

AddNotificationInput params.

type AddNotificationOutput

type AddNotificationOutput struct {
	// ID is the notification id. This field is required.
	ID string `json:"id"`
}

AddNotificationOutput params.

type AddProjectInput

type AddProjectInput struct {
	// Project is the project. This field is required.
	Project Project `json:"project"`
}

AddProjectInput params.

type AddProjectOutput

type AddProjectOutput struct {
	// ID is the project id. This field is required.
	ID string `json:"id"`
}

AddProjectOutput params.

type AddSearchInput

type AddSearchInput struct {
	// Search is the saved search. This field is required.
	Search Search `json:"search"`
}

AddSearchInput params.

type AddSearchOutput

type AddSearchOutput struct {
	// ID is the saved search id. This field is required.
	ID string `json:"id"`
}

AddSearchOutput params.

type AddTokenInput

type AddTokenInput struct {
	// Token is the token. This field is required.
	Token Token `json:"token"`
}

AddTokenInput params.

type AddTokenOutput

type AddTokenOutput struct {
	// ID is the token id.
	ID string `json:"id"`
}

AddTokenOutput params.

type Alert

type Alert struct {
	// CreatedAt is a timestamp indicating when the alert was created. This field is read-only.
	CreatedAt time.Time `json:"created_at"`

	// Description is the description of the alert.
	Description string `json:"description"`

	// ID is the alert id. This field is read-only.
	ID string `json:"id"`

	// Interval is the interval in minutes for performing the alert.
	Interval int `json:"interval"`

	// Limit is the maximum number of events in the alert notification.
	Limit int `json:"limit"`

	// Muted is a boolean used ignore trigger and resolve notifications.
	Muted bool `json:"muted"`

	// Name is the name of the alert. This field is required.
	Name string `json:"name"`

	// NotificationID is the notification id for reporting alerts, when omitted the alert will not run. This field is required.
	NotificationID string `json:"notification_id"`

	// Operator is the operator used when comparing against the threshold. This field is required. Must be one of: ">", ">=", "<", "<=".
	Operator string `json:"operator"`

	// ProjectID is the associated project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the query performed by the alert. This field is required.
	Query string `json:"query"`

	// Severity is the severity of the alert. This field is required. Must be one of: "info", "notice", "error", "critical".
	Severity string `json:"severity"`

	// Threshold is the threshold for comparison against the selected operator.
	Threshold int `json:"threshold"`

	// UpdatedAt is a timestamp indicating when the alert was last updated. This field is read-only.
	UpdatedAt time.Time `json:"updated_at"`
}

Alert represents configuration for performing alerting.

type BooleanFieldStat

type BooleanFieldStat struct {
	// Count is the number of times this field occurred in the sampled events.
	Count int `json:"count"`

	// Percent is the percentage of occurrences in the sampled events.
	Percent float64 `json:"percent"`

	// Value is the boolean value.
	Value bool `json:"value"`
}

BooleanFieldStat represents a boolean field's stats.

type Client

type Client struct {
	// URL is the required API endpoint address.
	URL string

	// AuthToken is an optional authentication token.
	AuthToken string

	// HTTPClient is the client used for making requests, defaulting to http.DefaultClient.
	HTTPClient *http.Client
}

Client is the API client.

func (*Client) AddAlert

func (c *Client) AddAlert(in AddAlertInput) (*AddAlertOutput, error)

AddAlert creates a new alert.

func (*Client) AddEvents

func (c *Client) AddEvents(in AddEventsInput) error

AddEvents ingests a batch of events.

func (*Client) AddNotification

func (c *Client) AddNotification(in AddNotificationInput) (*AddNotificationOutput, error)

AddNotification creates a new notification.

func (*Client) AddProject

func (c *Client) AddProject(in AddProjectInput) (*AddProjectOutput, error)

AddProject creates a new project.

func (*Client) AddSearch

func (c *Client) AddSearch(in AddSearchInput) (*AddSearchOutput, error)

AddSearch creates a new saved search.

func (*Client) AddToken

func (c *Client) AddToken(in AddTokenInput) (*AddTokenOutput, error)

AddToken creates a new token.

func (*Client) GetAlert

func (c *Client) GetAlert(in GetAlertInput) (*GetAlertOutput, error)

GetAlert returns an alert.

func (*Client) GetAlerts

func (c *Client) GetAlerts(in GetAlertsInput) (*GetAlertsOutput, error)

GetAlerts returns all alerts in a project.

func (*Client) GetBooleanFieldStats

func (c *Client) GetBooleanFieldStats(in GetBooleanFieldStatsInput) (*GetBooleanFieldStatsOutput, error)

GetBooleanFieldStats returns field statistics for a boolean field.

func (*Client) GetCount

func (c *Client) GetCount(in GetCountInput) (*GetCountOutput, error)

GetCount performs a search query against the log events, returning the number of matches.

func (*Client) GetDiscoveredFields

func (c *Client) GetDiscoveredFields(in GetDiscoveredFieldsInput) (*GetDiscoveredFieldsOutput, error)

GetDiscoveredFields returns fields discovered in the provided time range.

func (*Client) GetInstanceConfig

func (c *Client) GetInstanceConfig() (*GetInstanceConfigOutput, error)

GetInstanceConfig returns instance configuration.

func (*Client) GetNotification

func (c *Client) GetNotification(in GetNotificationInput) (*GetNotificationOutput, error)

GetNotification returns a notification.

func (*Client) GetNotifications

func (c *Client) GetNotifications(in GetNotificationsInput) (*GetNotificationsOutput, error)

GetNotifications returns all notifications.

func (*Client) GetNumericFieldStats

func (c *Client) GetNumericFieldStats(in GetNumericFieldStatsInput) (*GetNumericFieldStatsOutput, error)

GetNumericFieldStats returns field statistics for a numeric field.

func (*Client) GetProjectStats

func (c *Client) GetProjectStats(in GetProjectStatsInput) (*GetProjectStatsOutput, error)

GetProjectStats returns project statistics.

func (*Client) GetProjects

func (c *Client) GetProjects() (*GetProjectsOutput, error)

GetProjects returns all projects.

func (*Client) GetSearches

func (c *Client) GetSearches(in GetSearchesInput) (*GetSearchesOutput, error)

GetSearches returns all saved searches in a project.

func (*Client) GetStringFieldStats

func (c *Client) GetStringFieldStats(in GetStringFieldStatsInput) (*GetStringFieldStatsOutput, error)

GetStringFieldStats returns field statistics for a string field.

func (*Client) GetTimeseries

func (c *Client) GetTimeseries(in GetTimeseriesInput) (*GetTimeseriesOutput, error)

GetTimeseries returns a timeseries of event counts in the provided time range.

func (*Client) GetTokens

func (c *Client) GetTokens() (*GetTokensOutput, error)

GetTokens returns all tokens.

func (*Client) Query

func (c *Client) Query(in QueryInput) (*QueryOutput, error)

Query performs a SQL query against the log events.

func (*Client) RemoveAlert

func (c *Client) RemoveAlert(in RemoveAlertInput) error

RemoveAlert removes an alert.

func (*Client) RemoveNotification

func (c *Client) RemoveNotification(in RemoveNotificationInput) error

RemoveNotification removes a notification.

func (*Client) RemoveProject

func (c *Client) RemoveProject(in RemoveProjectInput) error

RemoveProject removes a project.

func (*Client) RemoveSearch

func (c *Client) RemoveSearch(in RemoveSearchInput) error

RemoveSearch removes a saved search.

func (*Client) RemoveToken

func (c *Client) RemoveToken(in RemoveTokenInput) error

RemoveToken removes a token.

func (*Client) Search

func (c *Client) Search(in SearchInput) (*SearchOutput, error)

Search performs a search query against the log events.

func (*Client) TestAlert

func (c *Client) TestAlert(in TestAlertInput) error

TestAlert test the alert configuration.

func (*Client) UpdateAlert

func (c *Client) UpdateAlert(in UpdateAlertInput) error

UpdateAlert updates an alert.

func (*Client) UpdateNotification

func (c *Client) UpdateNotification(in UpdateNotificationInput) error

UpdateNotification updates a notification.

func (*Client) UpdateProject

func (c *Client) UpdateProject(in UpdateProjectInput) error

UpdateProject updates a project.

func (*Client) UpdateSearch

func (c *Client) UpdateSearch(in UpdateSearchInput) error

UpdateSearch updates a saved search.

type DiscoveredField

type DiscoveredField struct {
	// Count is the number of times this field occurred in the sampled events.
	Count int `json:"count"`

	// Name is the field name.
	Name string `json:"name"`

	// Percent is the percentage of occurrences in the sampled events.
	Percent float64 `json:"percent"`

	// Type is the type of discovered field. Must be one of: "string", "number", "boolean".
	Type string `json:"type"`
}

DiscoveredField represents a single discovered field.

type Error

type Error struct {
	Status     string
	StatusCode int
	Type       string
	Message    string
}

Error is an error returned by the client.

func (Error) Error

func (e Error) Error() string

Error implementation.

type Event

type Event struct {
	// Fields is the log fields.
	Fields map[string]interface{} `json:"fields"`

	// ID is the event id.
	ID string `json:"id"`

	// Level is the severity level. This field is required. Must be one of: "debug", "info", "notice", "warning", "error", "critical", "alert", "emergency".
	Level string `json:"level"`

	// Message is the log message. This field is required.
	Message string `json:"message"`

	// Timestamp is the creation timestamp.
	Timestamp time.Time `json:"timestamp"`
}

Event represents a single log event.

type GetAlertInput

type GetAlertInput struct {
	// AlertID is the alert id. This field is required.
	AlertID string `json:"alert_id"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetAlertInput params.

type GetAlertOutput

type GetAlertOutput struct {
	// Alert is the alert. This field is required.
	Alert Alert `json:"alert"`
}

GetAlertOutput params.

type GetAlertsInput

type GetAlertsInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetAlertsInput params.

type GetAlertsOutput

type GetAlertsOutput struct {
	// Alerts is the alerts. This field is required.
	Alerts []Alert `json:"alerts"`
}

GetAlertsOutput params.

type GetBooleanFieldStatsInput

type GetBooleanFieldStatsInput struct {
	// Field is the field name. This field is required.
	Field string `json:"field"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetBooleanFieldStatsInput params.

type GetBooleanFieldStatsOutput

type GetBooleanFieldStatsOutput struct {
	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`

	// Values is the boolean values. This field is required.
	Values []BooleanFieldStat `json:"values"`
}

GetBooleanFieldStatsOutput params.

type GetCountInput

type GetCountInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetCountInput params.

type GetCountOutput

type GetCountOutput struct {
	// Count is the query result count. This field is required.
	Count int `json:"count"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

GetCountOutput params.

type GetDiscoveredFieldsInput

type GetDiscoveredFieldsInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetDiscoveredFieldsInput params.

type GetDiscoveredFieldsOutput

type GetDiscoveredFieldsOutput struct {
	// Fields is the fields discovered. This field is required.
	Fields []DiscoveredField `json:"fields"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

GetDiscoveredFieldsOutput params.

type GetInstanceConfigOutput

type GetInstanceConfigOutput struct {
	// Config is the instance configuration.
	Config InstanceConfig `json:"config"`
}

GetInstanceConfigOutput params.

type GetNotificationInput

type GetNotificationInput struct {
	// NotificationID is the notification id. This field is required.
	NotificationID string `json:"notification_id"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetNotificationInput params.

type GetNotificationOutput

type GetNotificationOutput struct {
	// Notification is the notification. This field is required.
	Notification Notification `json:"notification"`
}

GetNotificationOutput params.

type GetNotificationsInput

type GetNotificationsInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetNotificationsInput params.

type GetNotificationsOutput

type GetNotificationsOutput struct {
	// Notifications is the notifications. This field is required.
	Notifications []Notification `json:"notifications"`
}

GetNotificationsOutput params.

type GetNumericFieldStatsInput

type GetNumericFieldStatsInput struct {
	// Field is the field name. This field is required.
	Field string `json:"field"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetNumericFieldStatsInput params.

type GetNumericFieldStatsOutput

type GetNumericFieldStatsOutput struct {
	// Avg is the avg value. This field is required.
	Avg float64 `json:"avg"`

	// Max is The max value. This field is required.
	Max float64 `json:"max"`

	// Min is the min value. This field is required.
	Min float64 `json:"min"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

GetNumericFieldStatsOutput params.

type GetProjectStatsInput

type GetProjectStatsInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetProjectStatsInput params.

type GetProjectStatsOutput

type GetProjectStatsOutput struct {
	// BytesTotal is the total number of bytes stored. This field is required.
	BytesTotal int `json:"bytes_total"`

	// EventsTotal is the total number of events stored. This field is required.
	EventsTotal int `json:"events_total"`
}

GetProjectStatsOutput params.

type GetProjectsOutput

type GetProjectsOutput struct {
	// Projects is the projects. This field is required.
	Projects []Project `json:"projects"`
}

GetProjectsOutput params.

type GetSearchesInput

type GetSearchesInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

GetSearchesInput params.

type GetSearchesOutput

type GetSearchesOutput struct {
	// Searches is the saved searches.
	Searches []Search `json:"searches"`
}

GetSearchesOutput params.

type GetStringFieldStatsInput

type GetStringFieldStatsInput struct {
	// Field is the field name. This field is required.
	Field string `json:"field"`

	// Limit is the maximum number of values to return.
	Limit int `json:"limit"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetStringFieldStatsInput params.

type GetStringFieldStatsOutput

type GetStringFieldStatsOutput struct {
	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`

	// Values is the string values. This field is required.
	Values []StringFieldStat `json:"values"`
}

GetStringFieldStatsOutput params.

type GetTimeseriesInput

type GetTimeseriesInput struct {
	// MaxPoints is the maxmimum number of datapoints to return. This field is required.
	MaxPoints int `json:"max_points"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

GetTimeseriesInput params.

type GetTimeseriesOutput

type GetTimeseriesOutput struct {
	// Points is the series. This field is required.
	Points []TimeseriesPoint `json:"points"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

GetTimeseriesOutput params.

type GetTokensOutput

type GetTokensOutput struct {
	// Tokens is the tokens.
	Tokens []Token `json:"tokens"`
}

GetTokensOutput params.

type InstanceConfig

type InstanceConfig struct {
	// ProjectID is the Google Cloud project id.
	ProjectID string `json:"project_id"`

	// Region is the Google Cloud region id.
	Region string `json:"region"`

	// TeamID is the Apex team id.
	TeamID string `json:"team_id"`
}

InstanceConfig represents an instance's configuration.

type Notification

type Notification struct {
	// CreatedAt is a timestamp indicating when the notification was created. This field is read-only.
	CreatedAt time.Time `json:"created_at"`

	// EmailAddresses is the receipients of the alert notifications.
	EmailAddresses []string `json:"email_addresses"`

	// ID is the notification id. This field is read-only.
	ID string `json:"id"`

	// Name is the name of the notification. This field is required.
	Name string `json:"name"`

	// PagerdutyServiceKey is the PagerDuty service key.
	PagerdutyServiceKey string `json:"pagerduty_service_key"`

	// ProjectID is the associated project id. This field is required.
	ProjectID string `json:"project_id"`

	// SlackChannel is the Slack channel name, otherwise the default for the webhook is used.
	SlackChannel string `json:"slack_channel"`

	// SlackWebhookURL is the Slack webhook URL.
	SlackWebhookURL string `json:"slack_webhook_url"`

	// SmsNumbers is the receipients of the alert notifications.
	SmsNumbers []string `json:"sms_numbers"`

	// Type is the type of notification. This field is required. Must be one of: "slack", "pagerduty", "email", "sms", "webhook".
	Type string `json:"type"`

	// UpdatedAt is a timestamp indicating when the notification was last updated. This field is read-only.
	UpdatedAt time.Time `json:"updated_at"`

	// WebhookURL is the webhook URL which receives the alert payloads.
	WebhookURL string `json:"webhook_url"`
}

Notification represents an alert notification.

type Project

type Project struct {
	// CreatedAt is a timestamp indicating when the project was created. This field is read-only.
	CreatedAt time.Time `json:"created_at"`

	// Description is the project description.
	Description string `json:"description"`

	// ID is the project id. This field is read-only.
	ID string `json:"id"`

	// Location is the geographical location where the log events are stored. This field is required. Must be one of: "us-west2", "northamerica-northeast1", "us-east4", "southamerica-east1", "europe-north1", "europe-west2", "europe-west6", "asia-east2", "asia-south1", "asia-northeast2", "asia-east1", "asia-northeast1", "asia-southeast1", "australia-southeast1".
	Location string `json:"location"`

	// Mode is the storage mode, optimized for plain-text or structured logs. Both options support plain-text and structured logging, however, the structured mode shards on the `message` value, restricting its length to 1024 bytes. This field is required. Must be one of: "plain_text", "structured".
	Mode string `json:"mode"`

	// Name is the human-friendly project name. This field is required.
	Name string `json:"name"`

	// Retention is the retention of log events in days. When zero the logs do not expire.
	Retention int `json:"retention"`

	// UpdatedAt is a timestamp indicating when the project was last updated. This field is read-only.
	UpdatedAt time.Time `json:"updated_at"`
}

Project represents an isolated set of log events and alerts. A project can be created for each application, environment, or team within an organization depending on your preferences.

type QueryInput

type QueryInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the SQL query string. This field is required.
	Query string `json:"query"`
}

QueryInput params.

type QueryOutput

type QueryOutput struct {
	// Results is the query results. This field is required.
	Results []map[string]interface{} `json:"results"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

QueryOutput params.

type QueryStats

type QueryStats struct {
	// CacheHit is a boolean indicating if the query was cached.
	CacheHit bool `json:"cache_hit"`

	// Duration is the query duration in milliseconds.
	Duration int `json:"duration"`

	// TotalBytesBilled is the total number of bytes billed by the query.
	TotalBytesBilled int `json:"total_bytes_billed"`

	// TotalBytesProcessed is the total number of bytes processed by the query.
	TotalBytesProcessed int `json:"total_bytes_processed"`
}

QueryStats represents query statistics.

type RemoveAlertInput

type RemoveAlertInput struct {
	// AlertID is the alert id. This field is required.
	AlertID string `json:"alert_id"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

RemoveAlertInput params.

type RemoveNotificationInput

type RemoveNotificationInput struct {
	// NotificationID is the notification id. This field is required.
	NotificationID string `json:"notification_id"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

RemoveNotificationInput params.

type RemoveProjectInput

type RemoveProjectInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`
}

RemoveProjectInput params.

type RemoveSearchInput

type RemoveSearchInput struct {
	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// SearchID is the saved search id. This field is required.
	SearchID string `json:"search_id"`
}

RemoveSearchInput params.

type RemoveTokenInput

type RemoveTokenInput struct {
	// TokenID is the token id. This field is required.
	TokenID string `json:"token_id"`
}

RemoveTokenInput params.

type Search struct {
	// CreatedAt is a timestamp indicating when the saved search was created. This field is read-only.
	CreatedAt time.Time `json:"created_at"`

	// ID is the saved search id. This field is read-only.
	ID string `json:"id"`

	// Name is the name of the saved search. This field is required.
	Name string `json:"name"`

	// ProjectID is the associated project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the saved search query. This field is required.
	Query string `json:"query"`

	// UpdatedAt is a timestamp indicating when the saved search was last updated. This field is read-only.
	UpdatedAt time.Time `json:"updated_at"`
}

Search represents a saved search query.

type SearchInput

type SearchInput struct {
	// Limit is the maxmimum number of events to return.
	Limit int `json:"limit"`

	// Order is the query timestamp sort order. Must be one of: "ascending", "descending".
	Order string `json:"order"`

	// ProjectID is the project id. This field is required.
	ProjectID string `json:"project_id"`

	// Query is the search query string.
	Query string `json:"query"`

	// Start is the start timestamp, events before this time are not included. This field is required.
	Start time.Time `json:"start"`

	// Stop is the stop timestamp, events after this time are not included. This field is required.
	Stop time.Time `json:"stop"`
}

SearchInput params.

type SearchOutput

type SearchOutput struct {
	// Events is the query search results. This field is required.
	Events []Event `json:"events"`

	// Stats is the query statistics. This field is required.
	Stats QueryStats `json:"stats"`
}

SearchOutput params.

type StringFieldStat

type StringFieldStat struct {
	// Count is the number of times this field occurred in the sampled events.
	Count int `json:"count"`

	// Percent is the percentage of occurrences in the sampled events.
	Percent float64 `json:"percent"`

	// Value is the string value.
	Value string `json:"value"`
}

StringFieldStat represents a string field's stats.

type TestAlertInput

type TestAlertInput struct {
	// Alert is the alert. This field is required.
	Alert Alert `json:"alert"`
}

TestAlertInput params.

type TimeseriesPoint

type TimeseriesPoint struct {
	// Count is the number of events for this bucket.
	Count int `json:"count"`

	// Timestamp is the bucket timestamp.
	Timestamp time.Time `json:"timestamp"`
}

TimeseriesPoint represents a single point in a timeseries query.

type Token

type Token struct {
	// CreatedAt is a timestamp indicating when the token was created. This field is read-only.
	CreatedAt time.Time `json:"created_at"`

	// Description is the description of the token.
	Description string `json:"description"`

	// ID is the token. This field is read-only.
	ID string `json:"id"`

	// LastUsedAt is a timestamp indicating when the token was last used. This field is read-only.
	LastUsedAt time.Time `json:"last_used_at"`

	// Scopes is available to this token, permitting access to read and write data. This field is required. Must be one of: "events:read", "events:write", "alerts:read", "alerts:write", "notifications:read", "notifications:write", "projects:read", "projects:write", "tokens:read", "tokens:write", "searches:read", "searches:write".
	Scopes []string `json:"scopes"`
}

Token represents an API token.

type UpdateAlertInput

type UpdateAlertInput struct {
	// Alert is the alert. This field is required.
	Alert Alert `json:"alert"`
}

UpdateAlertInput params.

type UpdateNotificationInput

type UpdateNotificationInput struct {
	// Notification is the notification. This field is required.
	Notification Notification `json:"notification"`
}

UpdateNotificationInput params.

type UpdateProjectInput

type UpdateProjectInput struct {
	// Project is the project. This field is required.
	Project Project `json:"project"`
}

UpdateProjectInput params.

type UpdateSearchInput

type UpdateSearchInput struct {
	// Search is the saved search. This field is required.
	Search Search `json:"search"`
}

UpdateSearchInput params.

Jump to

Keyboard shortcuts

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