sls

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 28 Imported by: 0

README

This is a Golang SDK for Alibaba Cloud Log Service.

API Reference :

Build Status Coverage Status

Install Instruction

LogHub Golang SDK
go get github.com/aliyun/aliyun-log-go-sdk

Example

Write and Read LogHub

loghub_sample.go

Use Index on LogHub (SLS)

index_sample.go

Create Config for Logtail

log_config_sample.go

Create Machine Group for Logtail

machine_group_sample.go

For developer

Update log protobuf

protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --gofast_out=. log.proto

Documentation

Overview

Package sls is a generated protocol buffer package.

It is generated from these files:

log.proto

It has these top-level messages:

LogContent
Log
LogTag
LogGroup
SlsLogPackage
SlsLogPackageList
LogGroupList

Index

Constants

View Source
const (
	Compress_LZ4  = iota // 0
	Compress_None        // 1
	Compress_Max         // max compress type(just for filter invalid compress type)
)

compress type

View Source
const (
	NotificationTypeSMS           = "SMS"
	NotificationTypeWebhook       = "Webhook"
	NotificationTypeDingTalk      = "DingTalk"
	NotificationTypeEmail         = "Email"
	NotificationTypeMessageCenter = "MessageCenter"
)
View Source
const (

	// OffsetNewest stands for the log head offset, i.e. the offset that will be
	// assigned to the next message that will be produced to the shard.
	OffsetNewest = "end"
	// OffsetOldest stands for the oldest offset available on the logstore for a
	// shard.
	OffsetOldest = "begin"

	// ProgressHeader stands for the progress header in GetLogs response
	ProgressHeader = "X-Log-Progress"

	// GetLogsCountHeader stands for the count header in GetLogs response
	GetLogsCountHeader = "X-Log-Count"

	// RequestIDHeader stands for the requestID in all response
	RequestIDHeader = "x-log-requestid"
)
View Source
const (
	//EtlMetaURI is etl meta uri
	EtlMetaURI = "etlmetas"
	//EtlMetaNameURI is etl meta name uri
	EtlMetaNameURI = "etlmetanames"
	//EtlMetaAllTagMatch is for search meta without tag filtering
	EtlMetaAllTagMatch = "__all_etl_meta_tag_match__"
)
View Source
const (
	InputTypeSyslog    = "syslog"
	InputTypeStreamlog = "streamlog"
	InputTypePlugin    = "plugin"
	InputTypeFile      = "file"
)

const InputTypes

View Source
const (
	LogFileTypeApsaraLog    = "apsara_log"
	LogFileTypeRegexLog     = "common_reg_log"
	LogFileTypeJSONLog      = "json_log"
	LogFileTypeDelimiterLog = "delimiter_log"
)

const LogFileTypes

View Source
const (
	MergeTypeTopic    = "topic"
	MergeTypeLogstore = "logstore"
)

const MergeType

View Source
const (
	TopicFormatNone         = "none"        // no topic
	TopicFormatMachineGroup = "group_topic" // machine group's topic

)
View Source
const (
	PluginInputTypeDockerStdout = "service_docker_stdout"
	PPluginInputTypeCanal       = "service_canal"
)

const PluginInputType

View Source
const (
	MachineIDTypeIP          = "ip"
	MachineIDTypeUserDefined = "userdefined"
)

const MachineIDTypes

View Source
const BAD_REQUEST = "BadRequest"
View Source
const CONFIG_ALREADY_EXIST = "ConfigAlreadyExist"
View Source
const CONFIG_NOT_EXIST = "ConfigNotExist"
View Source
const GROUP_ALREADY_EXIST = "GroupAlreadyExist"
View Source
const GROUP_NOT_EXIST = "GroupNotExist"
View Source
const INTERNAL_SERVER_ERROR = "InternalServerError"
View Source
const INVALID_API_VERSION = "InvalidAPIVersion"
View Source
const INVALID_BODY_RAW_SIZE = "InvalidBodyRawSize"
View Source
const INVALID_COMPRESS_TYPE = "InvalidCompressType"
View Source
const INVALID_CONTENT_TYPE = "InvalidContentType"
View Source
const INVALID_CURSOR = "InvalidCursor"
View Source
const INVALID_DATE_FORMAT = "InvalidDateFormat"
View Source
const INVALID_ENCODING = "InvalidEncoding"
View Source
const INVALID_KEY = "InvalidKey"
View Source
const INVALID_LINE = "InvalidLine"
View Source
const INVALID_LOGSTORE_QUERY = "InvalidLogStoreQuery"
View Source
const INVALID_OFFSET = "InvalidOffset"
View Source
const INVALID_PARAMETER = "InvalidParameter"
View Source
const INVALID_QUERY_STRING = "InvalidQueryString"
View Source
const INVALID_REVERSE = "InvalidReverse"
View Source
const INVALID_SIGNATURE_METHOD = "InvalidSignatureMethod"
View Source
const INVALID_TIMESTAMP = "InvalidTimestamp"
View Source
const INVALID_TIME_RANGE = "InvalidTimeRange"
View Source
const LOGSTORE_ALREADY_EXIST = "LogStoreAlreadyExist"
View Source
const LOGSTORE_INFO_INVALID = "LogstoreInfoInvalid"
View Source
const LOGSTORE_NOT_EXIST = "LogStoreNotExist"
View Source
const LOGSTORE_WITHOUT_SHARD = "LogStoreWithoutShard"
View Source
const MISSING_API_VERSION = "MissingAPIVersion"
View Source
const MISSING_BODY_RAW_SIZE = "MissingBodyRawSize"
View Source
const MISSING_CONTENT_LENGTH = "MissingContentLength"
View Source
const MISSING_CONTENT_TYPE = "MissingContentType"
View Source
const MISSING_DATE = "MissingDate"
View Source
const MISSING_HOST = "MissingHost"
View Source
const MISSING_SIGNATURE_METHOD = "MissingSignatureMethod"
View Source
const MISS_ACCESS_KEY_ID = "MissAccessKeyId"
View Source
const (
	OSSShipperType = "oss"
)
View Source
const (
	OutputTypeLogService = "LogService"
)

const OutputType

View Source
const PARAMETER_INVALID = "ParameterInvalid"
View Source
const POST_BODY_INVALID = "PostBodyInvalid"
View Source
const POST_BODY_TOO_LARGE = "PostBodyTooLarge"
View Source
const POST_BODY_UNCOMPRESS_ERROR = "PostBodyUncompressError"
View Source
const PROJECT_FORBIDDEN = "ProjectForbidden"
View Source
const PROJECT_NOT_EXIST = "ProjectNotExist"
View Source
const PROJECT_QUOTA_EXCEED = "ProjectQuotaExceed"
View Source
const READ_QUOTA_EXCEED = "ReadQuotaExceed"
View Source
const REQUEST_TIME_TOO_SKEWED = "RequestTimeTooSkewed"
View Source
const SERVER_BUSY = "ServerBusy"
View Source
const SHARD_NOT_EXIST = "ShardNotExist"
View Source
const SHARD_READ_QUOTA_EXCEED = "ShardReadQuotaExceed"
View Source
const SHARD_WRITE_QUOTA_EXCEED = "ShardWriteQuotaExceed"
View Source
const SHIPPER_NOT_EXIST = "ShipperNotExist"
View Source
const SIGNATURE_NOT_MATCH = "SignatureNotMatch"
View Source
const UN_AUTHORIZED = "Unauthorized"
View Source
const WRITE_QUOTA_EXCEED = "WriteQuotaExceed"

Variables

View Source
var (
	ErrInvalidLengthLog = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowLog   = fmt.Errorf("proto: integer overflow")
)
View Source
var GlobalForceUsingHTTP = false

GlobalForceUsingHTTP if GlobalForceUsingHTTP is true, then all request will use HTTP(ignore LogProject's UsingHTTP flag)

View Source
var InvalidCompressError = errors.New("Invalid Compress Type")
View Source
var InvalidTypeError = errors.New("invalid config type")
View Source
var NoConfigFieldError = errors.New("no this config field")

Functions

func AddNecessaryApsaraLogInputConfigField

func AddNecessaryApsaraLogInputConfigField(inputConfigDetail map[string]interface{})

func AddNecessaryDelimiterLogInputConfigField

func AddNecessaryDelimiterLogInputConfigField(inputConfigDetail map[string]interface{})

func AddNecessaryInputConfigField

func AddNecessaryInputConfigField(inputConfigDetail map[string]interface{})

AddNecessaryInputConfigField ...

func AddNecessaryJSONLogInputConfigField

func AddNecessaryJSONLogInputConfigField(inputConfigDetail map[string]interface{})

func AddNecessaryLocalFileInputConfigField

func AddNecessaryLocalFileInputConfigField(inputConfigDetail map[string]interface{})

func AddNecessaryRegexLogInputConfigField

func AddNecessaryRegexLogInputConfigField(inputConfigDetail map[string]interface{})

func GetFileConfigInputDetailType

func GetFileConfigInputDetailType(detail InputDetailInterface) (string, bool)

func InitApsaraLogConfigInputDetail

func InitApsaraLogConfigInputDetail(detail *ApsaraLogConfigInputDetail)

InitApsaraLogConfigInputDetail ...

func InitCommonConfigInputDetail

func InitCommonConfigInputDetail(detail *CommonConfigInputDetail)

InitCommonConfigInputDetail ...

func InitDelimiterConfigInputDetail

func InitDelimiterConfigInputDetail(detail *DelimiterConfigInputDetail)

InitDelimiterConfigInputDetail ...

func InitJSONConfigInputDetail

func InitJSONConfigInputDetail(detail *JSONConfigInputDetail)

InitJSONConfigInputDetail ...

func InitLocalFileConfigInputDetail

func InitLocalFileConfigInputDetail(detail *LocalFileConfigInputDetail)

InitLocalFileConfigInputDetail ...

func InitPluginLogConfigInputDetail

func InitPluginLogConfigInputDetail(detail *PluginLogConfigInputDetail)

InitPluginLogConfigInputDetail ...

func InitRegexConfigInputDetail

func InitRegexConfigInputDetail(detail *RegexConfigInputDetail)

InitRegexConfigInputDetail ...

func InitStreamLogConfigInputDetail

func InitStreamLogConfigInputDetail(detail *StreamLogConfigInputDetail)

InitStreamLogConfigInputDetail ...

func IsTokenError

func IsTokenError(err error) bool

func IsValidInputType

func IsValidInputType(inputType string) bool

IsValidInputType check if specific inputType is valid

func Retry

func Retry(ctx context.Context, o backoff.Operation) error

Retry execute the input operation immediately at first, and do an exponential backoff retry when failed. The default max elapsed time is 15 minutes. The default retry intervals are shown below, in seconds.

1          0.5                     [0.25,   0.75]
2          0.75                    [0.375,  1.125]
3          1.125                   [0.562,  1.687]
4          1.687                   [0.8435, 2.53]
5          2.53                    [1.265,  3.795]
6          3.795                   [1.897,  5.692]
7          5.692                   [2.846,  8.538]
8          8.538                   [4.269, 12.807]
9         12.807                   [6.403, 19.210]

... The signature of backoff.Operation is "func() error".

func RetryWithAttempt

func RetryWithAttempt(ctx context.Context, maxAttempt int, o ConditionOperation) error

RetryWithAttempt ...

func RetryWithBackOff

func RetryWithBackOff(ctx context.Context, b backoff.BackOff, o backoff.Operation) error

RetryWithBackOff ...

func RetryWithCondition

func RetryWithCondition(ctx context.Context, b backoff.BackOff, o ConditionOperation) error

RetryWithCondition ...

func UpdateInputConfigField

func UpdateInputConfigField(detail InputDetailInterface, key string, val interface{}) error

UpdateInputConfigField ...

Types

type Alert

type Alert struct {
	Name             string              `json:"name"`
	DisplayName      string              `json:"displayName"`
	Description      string              `json:"description"`
	State            string              `json:"state"`
	Configuration    *AlertConfiguration `json:"configuration"`
	Schedule         *Schedule           `json:"schedule"`
	CreateTime       int64               `json:"createTime,omitempty"`
	LastModifiedTime int64               `json:"lastModifiedTime,omitempty"`
}

func (*Alert) MarshalJSON

func (alert *Alert) MarshalJSON() ([]byte, error)

type AlertConfiguration

type AlertConfiguration struct {
	Condition        string          `json:"condition"`
	Dashboard        string          `json:"dashboard"`
	QueryList        []*AlertQuery   `json:"queryList"`
	MuteUntil        int64           `json:"muteUntil"`
	NotificationList []*Notification `json:"notificationList"`
	NotifyThreshold  int32           `json:"notifyThreshold"`
	Throttling       string          `json:"throttling"`
}

type AlertQuery

type AlertQuery struct {
	ChartTitle   string `json:"chartTitle"`
	LogStore     string `json:"logStore"`
	Query        string `json:"query"`
	TimeSpanType string `json:"timeSpanType"`
	Start        string `json:"start"`
	End          string `json:"end"`
}

type ApsaraLogConfigInputDetail

type ApsaraLogConfigInputDetail struct {
	LocalFileConfigInputDetail
	LogBeginRegex string `json:"logBeginRegex"`
}

ApsaraLogConfigInputDetail apsara log config

func ConvertToApsaraLogConfigInputDetail

func ConvertToApsaraLogConfigInputDetail(detail InputDetailInterface) (*ApsaraLogConfigInputDetail, bool)

type BadResponseError

type BadResponseError struct {
	RespBody   string
	RespHeader map[string][]string
	HTTPCode   int
}

BadResponseError : special sls error, not valid json format

func NewBadResponseError

func NewBadResponseError(body string, header map[string][]string, httpCode int) *BadResponseError

NewBadResponseError ...

func (BadResponseError) Error

func (e BadResponseError) Error() string

func (BadResponseError) String

func (e BadResponseError) String() string

type Chart

type Chart struct {
	Title   string       `json:"title"`
	Type    string       `json:"type"`
	Search  ChartSearch  `json:"search"`
	Display ChartDisplay `json:"display"`
}

type ChartDisplay

type ChartDisplay struct {
	XAxisKeys   []string `json:"xAxis,omitempty"`
	YAxisKeys   []string `json:"yAxis,omitempty"`
	XPosition   int      `json:"xPos"`
	YPosition   int      `json:"yPos"`
	Width       int      `json:"width"`
	Height      int      `json:"height"`
	DisplayName string   `json:"displayName"`
}

type ChartSearch

type ChartSearch struct {
	Logstore string `json:"logstore"`
	Topic    string `json:"topic"`
	Query    string `json:"query"`
	Start    string `json:"start"`
	End      string `json:"end"`
}

type Client

type Client struct {
	Endpoint        string // IP or hostname of SLS endpoint
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
	UserAgent       string // default defaultLogUserAgent
	// contains filtered or unexported fields
}

Client ...

func (*Client) ApplyConfigToMachineGroup

func (c *Client) ApplyConfigToMachineGroup(project string, confName, groupName string) (err error)

ApplyConfigToMachineGroup applies config to machine group.

func (*Client) CheckConfigExist

func (c *Client) CheckConfigExist(project string, config string) (ok bool, err error)

CheckConfigExist check config exist or not

func (*Client) CheckLogstoreExist

func (c *Client) CheckLogstoreExist(project string, logstore string) (bool, error)

CheckLogstoreExist check logstore exist or not

func (*Client) CheckMachineGroupExist

func (c *Client) CheckMachineGroupExist(project string, machineGroup string) (bool, error)

CheckMachineGroupExist check machine group exist or not

func (*Client) CheckProjectExist

func (c *Client) CheckProjectExist(name string) (bool, error)

CheckProjectExist check project exist or not

func (*Client) Close

func (c *Client) Close() error

Close the client

func (*Client) CreateAlert

func (c *Client) CreateAlert(project string, alert *Alert) error

func (*Client) CreateChart

func (c *Client) CreateChart(project, dashboardName string, chart Chart) error

func (*Client) CreateConfig

func (c *Client) CreateConfig(project string, config *LogConfig) (err error)

CreateConfig creates a new config in SLS.

func (*Client) CreateConfigString

func (c *Client) CreateConfigString(project string, config string) (err error)

CreateConfigString creates a new config in SLS.

func (*Client) CreateConsumerGroup

func (c *Client) CreateConsumerGroup(project, logstore string, cg ConsumerGroup) (err error)

CreateConsumerGroup ...

func (*Client) CreateDashboard

func (c *Client) CreateDashboard(project string, dashboard Dashboard) error

func (*Client) CreateDashboardString

func (c *Client) CreateDashboardString(project string, dashboardStr string) error

func (*Client) CreateEtlMeta

func (c *Client) CreateEtlMeta(project string, etlMeta *EtlMeta) (err error)

func (*Client) CreateIndex

func (c *Client) CreateIndex(project, logstore string, index Index) error

CreateIndex ...

func (*Client) CreateIndexString

func (c *Client) CreateIndexString(project, logstore string, index string) error

CreateIndexString ...

func (*Client) CreateLogStore

func (c *Client) CreateLogStore(project string, logstore string, ttl, shardCnt int, autoSplit bool, maxSplitShard int) error

CreateLogStore creates a new logstore in SLS, where name is logstore name, and ttl is time-to-live(in day) of logs, and shardCnt is the number of shards, and autoSplit is auto split, and maxSplitShard is the max number of shard.

func (*Client) CreateLogStoreV2

func (c *Client) CreateLogStoreV2(project string, logstore *LogStore) error

CreateLogStoreV2 creates a new logstore in SLS

func (*Client) CreateMachineGroup

func (c *Client) CreateMachineGroup(project string, m *MachineGroup) error

CreateMachineGroup creates a new machine group in SLS.

func (*Client) CreateProject

func (c *Client) CreateProject(name, description string) (*LogProject, error)

CreateProject create a new loghub project.

func (*Client) CreateSavedSearch

func (c *Client) CreateSavedSearch(project string, savedSearch *SavedSearch) error

func (*Client) DeleteAlert

func (c *Client) DeleteAlert(project string, alertName string) error

func (*Client) DeleteChart

func (c *Client) DeleteChart(project, dashboardName, chartName string) error

func (*Client) DeleteConfig

func (c *Client) DeleteConfig(project string, config string) (err error)

DeleteConfig deletes a config according by config name.

func (*Client) DeleteConsumerGroup

func (c *Client) DeleteConsumerGroup(project, logstore string, cgName string) (err error)

DeleteConsumerGroup ...

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(project, name string) error

func (*Client) DeleteEtlMeta

func (c *Client) DeleteEtlMeta(project string, etlMetaName, etlMetaKey string) (err error)

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(project, logstore string) error

DeleteIndex ...

func (*Client) DeleteLogStore

func (c *Client) DeleteLogStore(project string, logstore string) (err error)

DeleteLogStore deletes a logstore according by logstore name.

func (*Client) DeleteMachineGroup

func (c *Client) DeleteMachineGroup(project string, machineGroup string) (err error)

DeleteMachineGroup deletes machine group according machine group name.

func (*Client) DeleteProject

func (c *Client) DeleteProject(name string) error

DeleteProject ...

func (*Client) DeleteSavedSearch

func (c *Client) DeleteSavedSearch(project string, savedSearchName string) error

func (*Client) DisableAlert

func (c *Client) DisableAlert(project string, alertName string) error

func (*Client) EnableAlert

func (c *Client) EnableAlert(project string, alertName string) error

func (*Client) GetAlert

func (c *Client) GetAlert(project string, alertName string) (*Alert, error)

func (*Client) GetAppliedConfigs

func (c *Client) GetAppliedConfigs(project string, groupName string) (confNames []string, err error)

GetAppliedConfigs returns applied config names list according machine group name groupName.

func (*Client) GetAppliedMachineGroups

func (c *Client) GetAppliedMachineGroups(project string, confName string) (groupNames []string, err error)

GetAppliedMachineGroups returns applied machine group names list according config name.

func (*Client) GetChart

func (c *Client) GetChart(project, dashboardName, chartName string) (chart *Chart, err error)

func (*Client) GetCheckpoint

func (c *Client) GetCheckpoint(project, logstore string, cgName string) (checkPointList []*ConsumerGroupCheckPoint, err error)

GetCheckpoint ...

func (*Client) GetConfig

func (c *Client) GetConfig(project string, config string) (logConfig *LogConfig, err error)

GetConfig returns config according by config name.

func (*Client) GetConfigString

func (c *Client) GetConfigString(project string, config string) (logConfig string, err error)

GetConfigString returns config according by config name.

func (*Client) GetCursor

func (c *Client) GetCursor(project, logstore string, shardID int, from string) (cursor string, err error)

GetCursor gets log cursor of one shard specified by shardId. The from can be in three form: a) unix timestamp in seccond, b) "begin", c) "end". For more detail please read: https://help.aliyun.com/document_detail/29024.html

func (*Client) GetCursorTime

func (c *Client) GetCursorTime(project, logstore string, shardID int, cursor string) (cursorTime time.Time, err error)

GetCursorTime ...

func (*Client) GetDashboard

func (c *Client) GetDashboard(project, name string) (dashboard *Dashboard, err error)

func (*Client) GetDashboardString

func (c *Client) GetDashboardString(project, name string) (dashboard string, err error)

func (*Client) GetEtlMeta

func (c *Client) GetEtlMeta(project string, etlMetaName, etlMetaKey string) (etlMeta *EtlMeta, err error)

func (*Client) GetHistograms

func (c *Client) GetHistograms(project, logstore string, topic string, from int64, to int64, queryExp string) (*GetHistogramsResponse, error)

GetHistograms query logs with [from, to) time range

func (*Client) GetIndex

func (c *Client) GetIndex(project, logstore string) (*Index, error)

GetIndex ...

func (*Client) GetIndexString

func (c *Client) GetIndexString(project, logstore string) (string, error)

GetIndexString ...

func (*Client) GetLogStore

func (c *Client) GetLogStore(project string, logstore string) (*LogStore, error)

GetLogStore returns logstore according by logstore name.

func (*Client) GetLogs

func (c *Client) GetLogs(project, logstore string, topic string, from int64, to int64, queryExp string,
	maxLineNum int64, offset int64, reverse bool) (*GetLogsResponse, error)

GetLogs query logs with [from, to) time range

func (*Client) GetLogsBytes

func (c *Client) GetLogsBytes(project, logstore string, shardID int, cursor, endCursor string,
	logGroupMaxCount int) (out []byte, nextCursor string, err error)

GetLogsBytes gets logs binary data from shard specified by shardId according cursor and endCursor. The logGroupMaxCount is the max number of logGroup could be returned. The nextCursor is the next curosr can be used to read logs at next time.

func (*Client) GetMachineGroup

func (c *Client) GetMachineGroup(project string, machineGroup string) (m *MachineGroup, err error)

GetMachineGroup retruns machine group according by machine group name.

func (*Client) GetPrevCursorTime

func (c *Client) GetPrevCursorTime(project, logstore string, shardID int, cursor string) (cursorTime time.Time, err error)

GetPrevCursorTime ...

func (*Client) GetProject

func (c *Client) GetProject(name string) (*LogProject, error)

GetProject ...

func (*Client) GetSavedSearch

func (c *Client) GetSavedSearch(project string, savedSearchName string) (*SavedSearch, error)

func (*Client) HeartBeat

func (c *Client) HeartBeat(project, logstore string, cgName, consumer string, heartBeatShardIDs []int) (shardIDs []int, err error)

HeartBeat ...

func (*Client) ListAlert

func (c *Client) ListAlert(project, alertName, dashboard string, offset, size int) (alerts []*Alert, total int, count int, err error)

func (*Client) ListConfig

func (c *Client) ListConfig(project string, offset, size int) (cfgNames []string, total int, err error)

ListConfig returns config names list and the total number of configs. The offset starts from 0 and the size is the max number of configs could be returned.

func (*Client) ListConsumerGroup

func (c *Client) ListConsumerGroup(project, logstore string) (cgList []*ConsumerGroup, err error)

ListConsumerGroup ...

func (*Client) ListDashboard

func (c *Client) ListDashboard(project string, dashboardName string, offset, size int) (dashboardList []string, count, total int, err error)

func (*Client) ListEtlMeta

func (c *Client) ListEtlMeta(project string, etlMetaName string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*Client) ListEtlMetaName

func (c *Client) ListEtlMetaName(project string, offset, size int) (total int, count int, etlMetaNameList []string, err error)

func (*Client) ListEtlMetaWithTag

func (c *Client) ListEtlMetaWithTag(project string, etlMetaName, etlMetaTag string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*Client) ListLogStore

func (c *Client) ListLogStore(project string) ([]string, error)

ListLogStore returns all logstore names of project p.

func (*Client) ListMachineGroup

func (c *Client) ListMachineGroup(project string, offset, size int) (m []string, total int, err error)

ListMachineGroup returns machine group name list and the total number of machine groups. The offset starts from 0 and the size is the max number of machine groups could be returned.

func (*Client) ListMachines

func (c *Client) ListMachines(project, machineGroupName string) (ms []*Machine, total int, err error)

func (*Client) ListProject

func (c *Client) ListProject() (projectNames []string, err error)

ListProject list all projects in specific region the region is related with the client's endpoint

func (*Client) ListProjectV2

func (c *Client) ListProjectV2(offset, size int) (projects []LogProject, count, total int, err error)

ListProjectV2 list all projects in specific region the region is related with the client's endpoint ref https://www.alibabacloud.com/help/doc-detail/74955.htm

func (*Client) ListSavedSearch

func (c *Client) ListSavedSearch(project string, savedSearchName string, offset, size int) (savedSearches []string, total int, count int, err error)

func (*Client) ListShards

func (c *Client) ListShards(project, logstore string) (shardIDs []*Shard, err error)

ListShards returns shard id list of this logstore.

func (*Client) MergeShards

func (c *Client) MergeShards(project, logstore string, shardID int) (shards []*Shard, err error)

MergeShards https://help.aliyun.com/document_detail/29022.html

func (*Client) PostLogStoreLogs

func (c *Client) PostLogStoreLogs(project, logstore string, lg *LogGroup, hashKey *string) (err error)

PostLogStoreLogs put logs into Shard logstore by hashKey. The callers should transform user logs into LogGroup.

func (*Client) PullLogs

func (c *Client) PullLogs(project, logstore string, shardID int, cursor, endCursor string,
	logGroupMaxCount int) (gl *LogGroupList, nextCursor string, err error)

PullLogs gets logs from shard specified by shardId according cursor and endCursor. The logGroupMaxCount is the max number of logGroup could be returned. The nextCursor is the next cursor can be used to read logs at next time. @note if you want to pull logs continuous, set endCursor = ""

func (*Client) PutLogs

func (c *Client) PutLogs(project, logstore string, lg *LogGroup) (err error)

PutLogs put logs into logstore. The callers should transform user logs into LogGroup.

func (*Client) PutLogsWithCompressType

func (c *Client) PutLogsWithCompressType(project, logstore string, lg *LogGroup, compressType int) (err error)

PutLogsWithCompressType put logs into logstore with specific compress type. The callers should transform user logs into LogGroup.

func (*Client) PutRawLogWithCompressType

func (c *Client) PutRawLogWithCompressType(project, logstore string, rawLogData []byte, compressType int) (err error)

PutRawLogWithCompressType put raw log data to log service, no marshal

func (*Client) RemoveConfigFromMachineGroup

func (c *Client) RemoveConfigFromMachineGroup(project string, confName, groupName string) (err error)

RemoveConfigFromMachineGroup removes config from machine group.

func (*Client) ResetAccessKeyToken

func (c *Client) ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string)

ResetAccessKeyToken reset client's access key token

func (*Client) SplitShard

func (c *Client) SplitShard(project, logstore string, shardID int, splitKey string) (shards []*Shard, err error)

SplitShard https://help.aliyun.com/document_detail/29021.html

func (*Client) UpdateAlert

func (c *Client) UpdateAlert(project string, alert *Alert) error

func (*Client) UpdateChart

func (c *Client) UpdateChart(project, dashboardName string, chart Chart) error

func (*Client) UpdateCheckpoint

func (c *Client) UpdateCheckpoint(project, logstore string, cgName string, consumer string, shardID int, checkpoint string, forceSuccess bool) (err error)

UpdateCheckpoint ...

func (*Client) UpdateConfig

func (c *Client) UpdateConfig(project string, config *LogConfig) (err error)

UpdateConfig updates a config.

func (*Client) UpdateConfigString

func (c *Client) UpdateConfigString(project string, configName, configDetail string) (err error)

UpdateConfigString updates a config.

func (*Client) UpdateConsumerGroup

func (c *Client) UpdateConsumerGroup(project, logstore string, cg ConsumerGroup) (err error)

UpdateConsumerGroup ...

func (*Client) UpdateDashboard

func (c *Client) UpdateDashboard(project string, dashboard Dashboard) error

func (*Client) UpdateDashboardString

func (c *Client) UpdateDashboardString(project string, dashboardName, dashboardStr string) error

func (*Client) UpdateEtlMeta

func (c *Client) UpdateEtlMeta(project string, etlMeta *EtlMeta) (err error)

func (*Client) UpdateIndex

func (c *Client) UpdateIndex(project, logstore string, index Index) error

UpdateIndex ...

func (*Client) UpdateIndexString

func (c *Client) UpdateIndexString(project, logstore string, index string) error

UpdateIndexString ...

func (*Client) UpdateLogStore

func (c *Client) UpdateLogStore(project string, logstore string, ttl, shardCnt int) (err error)

UpdateLogStore updates a logstore according by logstore name, obviously we can't modify the logstore name itself.

func (*Client) UpdateLogStoreV2

func (c *Client) UpdateLogStoreV2(project string, logstore *LogStore) (err error)

UpdateLogStoreV2 updates a logstore according by logstore name, obviously we can't modify the logstore name itself.

func (*Client) UpdateMachineGroup

func (c *Client) UpdateMachineGroup(project string, m *MachineGroup) (err error)

UpdateMachineGroup updates a machine group.

func (*Client) UpdateProject

func (c *Client) UpdateProject(name, description string) (*LogProject, error)

UpdateProject create a new loghub project.

func (*Client) UpdateSavedSearch

func (c *Client) UpdateSavedSearch(project string, savedSearch *SavedSearch) error

type ClientInterface

type ClientInterface interface {
	// #################### Client Operations #####################
	// ResetAccessKeyToken reset client's access key token
	ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string)
	// Close the client
	Close() error

	// #################### Project Operations #####################
	// CreateProject create a new loghub project.
	CreateProject(name, description string) (*LogProject, error)
	GetProject(name string) (*LogProject, error)
	// ListProject list all projects in specific region
	// the region is related with the client's endpoint
	ListProject() (projectNames []string, err error)
	// ListProjectV2 list all projects in specific region
	// the region is related with the client's endpoint
	// ref https://www.alibabacloud.com/help/doc-detail/74955.htm
	ListProjectV2(offset, size int) (projects []LogProject, count, total int, err error)
	// CheckProjectExist check project exist or not
	CheckProjectExist(name string) (bool, error)
	// DeleteProject ...
	DeleteProject(name string) error

	// #################### Logstore Operations #####################
	// ListLogStore returns all logstore names of project p.
	ListLogStore(project string) ([]string, error)
	// GetLogStore returns logstore according by logstore name.
	GetLogStore(project string, logstore string) (*LogStore, error)
	// CreateLogStore creates a new logstore in SLS
	// where name is logstore name,
	// and ttl is time-to-live(in day) of logs,
	// and shardCnt is the number of shards,
	// and autoSplit is auto split,
	// and maxSplitShard is the max number of shard.
	CreateLogStore(project string, logstore string, ttl, shardCnt int, autoSplit bool, maxSplitShard int) error
	// CreateLogStoreV2 creates a new logstore in SLS
	CreateLogStoreV2(project string, logstore *LogStore) error
	// DeleteLogStore deletes a logstore according by logstore name.
	DeleteLogStore(project string, logstore string) (err error)
	// UpdateLogStore updates a logstore according by logstore name,
	// obviously we can't modify the logstore name itself.
	UpdateLogStore(project string, logstore string, ttl, shardCnt int) (err error)
	// UpdateLogStoreV2 updates a logstore according by logstore name,
	// obviously we can't modify the logstore name itself.
	UpdateLogStoreV2(project string, logstore *LogStore) error
	// CheckLogstoreExist check logstore exist or not
	CheckLogstoreExist(project string, logstore string) (bool, error)

	// #################### Logtail Operations #####################
	// ListMachineGroup returns machine group name list and the total number of machine groups.
	// The offset starts from 0 and the size is the max number of machine groups could be returned.
	ListMachineGroup(project string, offset, size int) (m []string, total int, err error)
	// ListMachines list all machines in machineGroupName
	ListMachines(project, machineGroupName string) (ms []*Machine, total int, err error)
	// CheckMachineGroupExist check machine group exist or not
	CheckMachineGroupExist(project string, machineGroup string) (bool, error)
	// GetMachineGroup retruns machine group according by machine group name.
	GetMachineGroup(project string, machineGroup string) (m *MachineGroup, err error)
	// CreateMachineGroup creates a new machine group in SLS.
	CreateMachineGroup(project string, m *MachineGroup) error
	// UpdateMachineGroup updates a machine group.
	UpdateMachineGroup(project string, m *MachineGroup) (err error)
	// DeleteMachineGroup deletes machine group according machine group name.
	DeleteMachineGroup(project string, machineGroup string) (err error)
	// ListConfig returns config names list and the total number of configs.
	// The offset starts from 0 and the size is the max number of configs could be returned.
	ListConfig(project string, offset, size int) (cfgNames []string, total int, err error)
	// CheckConfigExist check config exist or not
	CheckConfigExist(project string, config string) (ok bool, err error)
	// GetConfig returns config according by config name.
	GetConfig(project string, config string) (logConfig *LogConfig, err error)
	// GetConfigString returns config according by config name.
	GetConfigString(name string, config string) (c string, err error)
	// UpdateConfig updates a config.
	UpdateConfig(project string, config *LogConfig) (err error)
	// UpdateConfigString updates a config.
	UpdateConfigString(project string, configName, configDetail string) (err error)
	// CreateConfig creates a new config in SLS.
	CreateConfig(project string, config *LogConfig) (err error)
	// CreateConfigString creates a new config in SLS.
	CreateConfigString(project string, config string) (err error)
	// DeleteConfig deletes a config according by config name.
	DeleteConfig(project string, config string) (err error)
	// GetAppliedMachineGroups returns applied machine group names list according config name.
	GetAppliedMachineGroups(project string, confName string) (groupNames []string, err error)
	// GetAppliedConfigs returns applied config names list according machine group name groupName.
	GetAppliedConfigs(project string, groupName string) (confNames []string, err error)
	// ApplyConfigToMachineGroup applies config to machine group.
	ApplyConfigToMachineGroup(project string, confName, groupName string) (err error)
	// RemoveConfigFromMachineGroup removes config from machine group.
	RemoveConfigFromMachineGroup(project string, confName, groupName string) (err error)

	// #################### ETL Operations #####################
	CreateEtlMeta(project string, etlMeta *EtlMeta) (err error)
	UpdateEtlMeta(project string, etlMeta *EtlMeta) (err error)
	DeleteEtlMeta(project string, etlMetaName, etlMetaKey string) (err error)

	GetEtlMeta(project string, etlMetaName, etlMetaKey string) (etlMeta *EtlMeta, err error)
	ListEtlMeta(project string, etlMetaName string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)
	ListEtlMetaWithTag(project string, etlMetaName, etlMetaTag string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)
	ListEtlMetaName(project string, offset, size int) (total int, count int, etlMetaNameList []string, err error)

	// #################### Shard Operations #####################
	// ListShards returns shard id list of this logstore.
	ListShards(project, logstore string) (shards []*Shard, err error)
	// SplitShard https://help.aliyun.com/document_detail/29021.html
	SplitShard(project, logstore string, shardID int, splitKey string) (shards []*Shard, err error)
	// MergeShards https://help.aliyun.com/document_detail/29022.html
	MergeShards(project, logstore string, shardID int) (shards []*Shard, err error)

	// #################### Log Operations #####################
	// PutLogs put logs into logstore.
	// The callers should transform user logs into LogGroup.
	PutLogs(project, logstore string, lg *LogGroup) (err error)
	// PostLogStoreLogs put logs into Shard logstore by hashKey.
	// The callers should transform user logs into LogGroup.
	PostLogStoreLogs(project, logstore string, lg *LogGroup, hashKey *string) (err error)
	// PutLogsWithCompressType put logs into logstore with specific compress type.
	// The callers should transform user logs into LogGroup.
	PutLogsWithCompressType(project, logstore string, lg *LogGroup, compressType int) (err error)
	// PutRawLogWithCompressType put raw log data to log service, no marshal
	PutRawLogWithCompressType(project, logstore string, rawLogData []byte, compressType int) (err error)
	// GetCursor gets log cursor of one shard specified by shardId.
	// The from can be in three form: a) unix timestamp in seccond, b) "begin", c) "end".
	// For more detail please read: https://help.aliyun.com/document_detail/29024.html
	GetCursor(project, logstore string, shardID int, from string) (cursor string, err error)
	// GetLogsBytes gets logs binary data from shard specified by shardId according cursor and endCursor.
	// The logGroupMaxCount is the max number of logGroup could be returned.
	// The nextCursor is the next curosr can be used to read logs at next time.
	GetLogsBytes(project, logstore string, shardID int, cursor, endCursor string,
		logGroupMaxCount int) (out []byte, nextCursor string, err error)
	// PullLogs gets logs from shard specified by shardId according cursor and endCursor.
	// The logGroupMaxCount is the max number of logGroup could be returned.
	// The nextCursor is the next cursor can be used to read logs at next time.
	// @note if you want to pull logs continuous, set endCursor = ""
	PullLogs(project, logstore string, shardID int, cursor, endCursor string,
		logGroupMaxCount int) (gl *LogGroupList, nextCursor string, err error)
	// GetHistograms query logs with [from, to) time range
	GetHistograms(project, logstore string, topic string, from int64, to int64, queryExp string) (*GetHistogramsResponse, error)
	// GetLogs query logs with [from, to) time range
	GetLogs(project, logstore string, topic string, from int64, to int64, queryExp string,
		maxLineNum int64, offset int64, reverse bool) (*GetLogsResponse, error)

	// #################### Index Operations #####################
	// CreateIndex ...
	CreateIndex(project, logstore string, index Index) error
	// CreateIndexString ...
	CreateIndexString(project, logstore string, indexStr string) error
	// UpdateIndex ...
	UpdateIndex(project, logstore string, index Index) error
	// UpdateIndexString ...
	UpdateIndexString(project, logstore string, indexStr string) error
	// DeleteIndex ...
	DeleteIndex(project, logstore string) error
	// GetIndex ...
	GetIndex(project, logstore string) (*Index, error)
	// GetIndexString ...
	GetIndexString(project, logstore string) (string, error)

	// #################### Chart&Dashboard Operations #####################
	ListDashboard(project string, dashboardName string, offset, size int) (dashboardList []string, count, total int, err error)
	GetDashboard(project, name string) (dashboard *Dashboard, err error)
	GetDashboardString(project, name string) (dashboard string, err error)
	DeleteDashboard(project, name string) error
	UpdateDashboard(project string, dashboard Dashboard) error
	UpdateDashboardString(project string, dashboardName, dashboardStr string) error
	CreateDashboard(project string, dashboard Dashboard) error
	CreateDashboardString(project string, dashboardStr string) error
	GetChart(project, dashboardName, chartName string) (chart *Chart, err error)
	DeleteChart(project, dashboardName, chartName string) error
	UpdateChart(project, dashboardName string, chart Chart) error
	CreateChart(project, dashboardName string, chart Chart) error

	// #################### SavedSearch&Alert Operations #####################
	CreateSavedSearch(project string, savedSearch *SavedSearch) error
	UpdateSavedSearch(project string, savedSearch *SavedSearch) error
	DeleteSavedSearch(project string, savedSearchName string) error
	GetSavedSearch(project string, savedSearchName string) (*SavedSearch, error)
	ListSavedSearch(project string, savedSearchName string, offset, size int) (savedSearches []string, total int, count int, err error)
	CreateAlert(project string, alert *Alert) error
	UpdateAlert(project string, alert *Alert) error
	DeleteAlert(project string, alertName string) error
	GetAlert(project string, alertName string) (*Alert, error)
	DisableAlert(project string, alertName string) error
	EnableAlert(project string, alertName string) error
	ListAlert(project, alertName, dashboard string, offset, size int) (alerts []*Alert, total int, count int, err error)
	// contains filtered or unexported methods
}

ClientInterface for all log's open api

func CreateNormalInterface

func CreateNormalInterface(endpoint, accessKeyID, accessKeySecret, securityToken string) ClientInterface

CreateNormalInterface create a normal client

func CreateTokenAutoUpdateClient

func CreateTokenAutoUpdateClient(endpoint string, tokenUpdateFunc UpdateTokenFunction, shutdown <-chan struct{}) (client ClientInterface, err error)

CreateTokenAutoUpdateClient crate a TokenAutoUpdateClient this client will auto fetch security token and retry when operation is `Unauthorized` @note TokenAutoUpdateClient will destroy when shutdown channel is closed

type CommonConfigInputDetail

type CommonConfigInputDetail struct {
	LocalStorage    bool           `json:"localStorage"`
	FilterKeys      []string       `json:"filterKey,omitempty"`
	FilterRegex     []string       `json:"filterRegex,omitempty"`
	ShardHashKey    []string       `json:"shardHashKey,omitempty"`
	EnableTag       bool           `json:"enableTag"`
	EnableRawLog    bool           `json:"enableRawLog"`
	MaxSendRate     int            `json:"maxSendRate"`
	SendRateExpire  int            `json:"sendRateExpire"`
	SensitiveKeys   []SensitiveKey `json:"sensitive_keys,omitempty"`
	MergeType       string         `json:"mergeType,omitempty"`
	DelayAlarmBytes int            `json:"delayAlarmBytes,omitempty"`
	AdjustTimeZone  bool           `json:"adjustTimezone"`
	LogTimeZone     string         `json:"logTimezone,omitempty"`
	Priority        int            `json:"priority,omitempty"`
}

CommonConfigInputDetail is all input detail's basic config

type ConditionOperation

type ConditionOperation func() (bool, error)

ConditionOperation : retry depends on the retured bool

type ConfigPluginCanal

type ConfigPluginCanal struct {
	Host              string
	Port              int
	User              string
	Password          string
	Flavor            string
	ServerID          int
	IncludeTables     []string
	ExcludeTables     []string
	StartBinName      string
	StartBinLogPos    int
	HeartBeatPeriod   int
	ReadTimeout       int
	EnableDDL         bool
	EnableXID         bool
	EnableGTID        bool
	EnableInsert      bool
	EnableUpdate      bool
	EnableDelete      bool
	TextToString      bool
	StartFromBegining bool
	Charset           string
}

func CreateConfigPluginCanal

func CreateConfigPluginCanal() *ConfigPluginCanal

type ConfigPluginDockerStdout

type ConfigPluginDockerStdout struct {
	IncludeLabel         map[string]string
	ExcludeLabel         map[string]string
	IncludeEnv           map[string]string
	ExcludeEnv           map[string]string
	FlushIntervalMs      int
	TimeoutMs            int
	BeginLineRegex       string
	BeginLineTimeoutMs   int
	BeginLineCheckLength int
	MaxLogSize           int
	Stdout               bool
	Stderr               bool
}

func CreateConfigPluginDockerStdout

func CreateConfigPluginDockerStdout() *ConfigPluginDockerStdout

type ConsumerGroup

type ConsumerGroup struct {
	ConsumerGroupName string `json:"consumerGroup"`
	Timeout           int    `json:"timeout"` // timeout seconds
	InOrder           bool   `json:"order"`
}

ConsumerGroup type define

type ConsumerGroupCheckPoint

type ConsumerGroupCheckPoint struct {
	ShardID    int    `json:"shard"`
	CheckPoint string `json:"checkpoint"`
	UpdateTime int    `json:"updateTime"`
	Consumer   string `json:"consumer"`
}

ConsumerGroupCheckPoint type define

type Dashboard

type Dashboard struct {
	DashboardName string  `json:"dashboardName"`
	Description   string  `json:"description"`
	ChartList     []Chart `json:"charts"`
	DisplayName   string  `json:"displayName"`
}

type DelimiterConfigInputDetail

type DelimiterConfigInputDetail struct {
	LocalFileConfigInputDetail
	Separator  string   `json:"separator"`
	Quote      string   `json:"quote"`
	Key        []string `json:"key"`
	TimeKey    string   `json:"timeKey"`
	AutoExtend bool     `json:"autoExtend"`
}

DelimiterConfigInputDetail delimiter log config

func ConvertToDelimiterConfigInputDetail

func ConvertToDelimiterConfigInputDetail(detail InputDetailInterface) (*DelimiterConfigInputDetail, bool)

type ETLJob

type ETLJob struct {
	JobName        string          `json:"etlJobName"`
	SourceConfig   *SourceConfig   `json:"sourceConfig"`
	TriggerConfig  *TriggerConfig  `json:"triggerConfig"`
	FunctionConfig *FunctionConfig `json:"functionConfig"`

	// TODO: change this to map[string]interface{} once log service fixes the format
	FunctionParameter interface{}   `json:"functionParameter"`
	LogConfig         *JobLogConfig `json:"logConfig"`
	Enable            bool          `json:"enable"`

	CreateTime int64 `json:"createTime"`
	UpdateTime int64 `json:"updateTime"`
}

func (*ETLJob) UnmarshalJSON

func (job *ETLJob) UnmarshalJSON(data []byte) error

This can be removed once log service returns function parameter in json type. "functionParameter":{"a":1} instead of "functionParameter":"{\"a\":1}"

type Error

type Error struct {
	HTTPCode  int32  `json:"httpCode"`
	Code      string `json:"errorCode"`
	Message   string `json:"errorMessage"`
	RequestID string `json:"requestID"`
}

Error defines sls error

func NewClientError

func NewClientError(err error) *Error

NewClientError new client error

func (Error) Error

func (e Error) Error() string

func (Error) String

func (e Error) String() string

type EtlMeta

type EtlMeta struct {
	MetaName  string            `json:"etlMetaName"`
	MetaKey   string            `json:"etlMetaKey"`
	MetaTag   string            `json:"etlMetaTag"`
	MetaValue map[string]string `json:"etlMetaValue"`
}

type FunctionConfig

type FunctionConfig struct {
	FunctionProvider string `json:"functionProvider"`
	Endpoint         string `json:"endpoint"`
	AccountID        string `json:"accountId"`
	RegionName       string `json:"regionName"`
	ServiceName      string `json:"serviceName"`
	FunctionName     string `json:"functionName"`
}

type GetHistogramsResponse

type GetHistogramsResponse struct {
	Progress   string            `json:"progress"`
	Count      int64             `json:"count"`
	Histograms []SingleHistogram `json:"histograms"`
}

func (*GetHistogramsResponse) IsComplete

func (resp *GetHistogramsResponse) IsComplete() bool

type GetLogsResponse

type GetLogsResponse struct {
	Progress string              `json:"progress"`
	Count    int64               `json:"count"`
	Logs     []map[string]string `json:"logs"`
}

GetLogsResponse defines response from GetLogs call

func (*GetLogsResponse) IsComplete

func (resp *GetLogsResponse) IsComplete() bool

type Index

type Index struct {
	Keys map[string]IndexKey `json:"keys,omitempty"`
	Line *IndexLine          `json:"line,omitempty"`
}

Index is an index config for a log store.

func CreateDefaultIndex

func CreateDefaultIndex() *Index

CreateDefaultIndex return a full text index config

type IndexKey

type IndexKey struct {
	Token         []string `json:"token"` // tokens that split the log line.
	CaseSensitive bool     `json:"caseSensitive"`
	Type          string   `json:"type"` // text, long, double
	DocValue      bool     `json:"doc_value,omitempty"`
	Alias         string   `json:"alias,omitempty"`
	Chn           bool     `json:"chn"` // parse chinese or not
}

IndexKey ...

type IndexLine

type IndexLine struct {
	Token         []string `json:"token"`
	CaseSensitive bool     `json:"caseSensitive"`
	IncludeKeys   []string `json:"include_keys,omitempty"`
	ExcludeKeys   []string `json:"exclude_keys,omitempty"`
	Chn           bool     `json:"chn"` // parse chinese or not
}

type InputDetail

type InputDetail struct {
	LogType       string   `json:"logType"`
	LogPath       string   `json:"logPath"`
	FilePattern   string   `json:"filePattern"`
	LocalStorage  bool     `json:"localStorage"`
	TimeKey       string   `json:"timeKey"`
	TimeFormat    string   `json:"timeFormat"`
	LogBeginRegex string   `json:"logBeginRegex"`
	Regex         string   `json:"regex"`
	Keys          []string `json:"key"`
	FilterKeys    []string `json:"filterKey"`
	FilterRegex   []string `json:"filterRegex"`
	TopicFormat   string   `json:"topicFormat"`
	Separator     string   `json:"separator"`
	AutoExtend    bool     `json:"autoExtend"`
}

InputDetail defines log_config input @note : deprecated and no maintenance

func ConvertToInputDetail

func ConvertToInputDetail(detail InputDetailInterface) (*InputDetail, bool)

type InputDetailInterface

type InputDetailInterface interface {
}

InputDetailInterface all input detail's interface

type JSONConfigInputDetail

type JSONConfigInputDetail struct {
	LocalFileConfigInputDetail
	TimeKey string `json:"timeKey"`
}

JSONConfigInputDetail pure json log config

func ConvertToJSONConfigInputDetail

func ConvertToJSONConfigInputDetail(detail InputDetailInterface) (*JSONConfigInputDetail, bool)

type JobLogConfig

type JobLogConfig struct {
	Endpoint     string `json:"endpoint"`
	ProjectName  string `json:"projectName"`
	LogstoreName string `json:"logstoreName"`
}

type LocalFileConfigInputDetail

type LocalFileConfigInputDetail struct {
	CommonConfigInputDetail
	LogType            string            `json:"logType"`
	LogPath            string            `json:"logPath"`
	FilePattern        string            `json:"filePattern"`
	TimeFormat         string            `json:"timeFormat"`
	TopicFormat        string            `json:"topicFormat,omitempty"`
	Preserve           bool              `json:"preserve"`
	PreserveDepth      int               `json:"preserveDepth"`
	FileEncoding       string            `json:"fileEncoding,omitempty"`
	DiscardUnmatch     bool              `json:"discardUnmatch"`
	MaxDepth           int               `json:"maxDepth"`
	TailExisted        bool              `json:"tailExisted"`
	DiscardNonUtf8     bool              `json:"discardNonUtf8"`
	DelaySkipBytes     int               `json:"delaySkipBytes"`
	IsDockerFile       bool              `json:"dockerFile"`
	DockerIncludeLabel map[string]string `json:"dockerIncludeLabel,omitempty"`
	DockerExcludeLabel map[string]string `json:"dockerExcludeLabel,omitempty"`
	DockerIncludeEnv   map[string]string `json:"dockerIncludeEnv,omitempty"`
	DockerExcludeEnv   map[string]string `json:"dockerExcludeEnv,omitempty"`
}

LocalFileConfigInputDetail all file input detail's basic config

type Log

type Log struct {
	Time             *uint32       `protobuf:"varint,1,req,name=Time" json:"Time,omitempty"`
	Contents         []*LogContent `protobuf:"bytes,2,rep,name=Contents" json:"Contents,omitempty"`
	XXX_unrecognized []byte        `json:"-"`
}

func (*Log) Descriptor

func (*Log) Descriptor() ([]byte, []int)

func (*Log) GetContents

func (m *Log) GetContents() []*LogContent

func (*Log) GetTime

func (m *Log) GetTime() uint32

func (*Log) Marshal

func (m *Log) Marshal() (dAtA []byte, err error)

func (*Log) MarshalTo

func (m *Log) MarshalTo(dAtA []byte) (int, error)

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) Reset

func (m *Log) Reset()

func (*Log) Size

func (m *Log) Size() (n int)

func (*Log) String

func (m *Log) String() string

func (*Log) Unmarshal

func (m *Log) Unmarshal(dAtA []byte) error

type LogConfig

type LogConfig struct {
	Name         string               `json:"configName"`
	LogSample    string               `json:"logSample"`
	InputType    string               `json:"inputType"` // syslog plugin file
	InputDetail  InputDetailInterface `json:"inputDetail"`
	OutputType   string               `json:"outputType"`
	OutputDetail OutputDetail         `json:"outputDetail"`

	CreateTime     uint32 `json:"createTime,omitempty`
	LastModifyTime uint32 `json:"lastModifyTime,omitempty"`
}

LogConfig defines log config

type LogConfigPluginInput

type LogConfigPluginInput struct {
	Inputs      []*PluginInputItem `json:"inputs"`
	Processors  []*PluginInputItem `json:"processors,omitempty"`
	Aggregators []*PluginInputItem `json:"aggregators,omitempty"`
	Flushers    []*PluginInputItem `json:"flushers,omitempty"`
}

type LogContent

type LogContent struct {
	Key              *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"`
	Value            *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*LogContent) Descriptor

func (*LogContent) Descriptor() ([]byte, []int)

func (*LogContent) GetKey

func (m *LogContent) GetKey() string

func (*LogContent) GetValue

func (m *LogContent) GetValue() string

func (*LogContent) Marshal

func (m *LogContent) Marshal() (dAtA []byte, err error)

func (*LogContent) MarshalTo

func (m *LogContent) MarshalTo(dAtA []byte) (int, error)

func (*LogContent) ProtoMessage

func (*LogContent) ProtoMessage()

func (*LogContent) Reset

func (m *LogContent) Reset()

func (*LogContent) Size

func (m *LogContent) Size() (n int)

func (*LogContent) String

func (m *LogContent) String() string

func (*LogContent) Unmarshal

func (m *LogContent) Unmarshal(dAtA []byte) error

type LogGroup

type LogGroup struct {
	Logs             []*Log    `protobuf:"bytes,1,rep,name=Logs" json:"Logs,omitempty"`
	Category         *string   `protobuf:"bytes,2,opt,name=Category" json:"Category,omitempty"`
	Topic            *string   `protobuf:"bytes,3,opt,name=Topic" json:"Topic,omitempty"`
	Source           *string   `protobuf:"bytes,4,opt,name=Source" json:"Source,omitempty"`
	MachineUUID      *string   `protobuf:"bytes,5,opt,name=MachineUUID" json:"MachineUUID,omitempty"`
	LogTags          []*LogTag `protobuf:"bytes,6,rep,name=LogTags" json:"LogTags,omitempty"`
	XXX_unrecognized []byte    `json:"-"`
}

func (*LogGroup) Descriptor

func (*LogGroup) Descriptor() ([]byte, []int)

func (*LogGroup) GetCategory

func (m *LogGroup) GetCategory() string

func (*LogGroup) GetLogTags

func (m *LogGroup) GetLogTags() []*LogTag

func (*LogGroup) GetLogs

func (m *LogGroup) GetLogs() []*Log

func (*LogGroup) GetMachineUUID

func (m *LogGroup) GetMachineUUID() string

func (*LogGroup) GetSource

func (m *LogGroup) GetSource() string

func (*LogGroup) GetTopic

func (m *LogGroup) GetTopic() string

func (*LogGroup) Marshal

func (m *LogGroup) Marshal() (dAtA []byte, err error)

func (*LogGroup) MarshalTo

func (m *LogGroup) MarshalTo(dAtA []byte) (int, error)

func (*LogGroup) ProtoMessage

func (*LogGroup) ProtoMessage()

func (*LogGroup) Reset

func (m *LogGroup) Reset()

func (*LogGroup) Size

func (m *LogGroup) Size() (n int)

func (*LogGroup) String

func (m *LogGroup) String() string

func (*LogGroup) Unmarshal

func (m *LogGroup) Unmarshal(dAtA []byte) error

type LogGroupList

type LogGroupList struct {
	LogGroups        []*LogGroup `protobuf:"bytes,1,rep,name=LogGroups" json:"LogGroups,omitempty"`
	XXX_unrecognized []byte      `json:"-"`
}

func LogsBytesDecode

func LogsBytesDecode(data []byte) (gl *LogGroupList, err error)

LogsBytesDecode decodes logs binary data returned by GetLogsBytes API

func (*LogGroupList) Descriptor

func (*LogGroupList) Descriptor() ([]byte, []int)

func (*LogGroupList) GetLogGroups

func (m *LogGroupList) GetLogGroups() []*LogGroup

func (*LogGroupList) Marshal

func (m *LogGroupList) Marshal() (dAtA []byte, err error)

func (*LogGroupList) MarshalTo

func (m *LogGroupList) MarshalTo(dAtA []byte) (int, error)

func (*LogGroupList) ProtoMessage

func (*LogGroupList) ProtoMessage()

func (*LogGroupList) Reset

func (m *LogGroupList) Reset()

func (*LogGroupList) Size

func (m *LogGroupList) Size() (n int)

func (*LogGroupList) String

func (m *LogGroupList) String() string

func (*LogGroupList) Unmarshal

func (m *LogGroupList) Unmarshal(dAtA []byte) error

type LogProject

type LogProject struct {
	Name           string `json:"projectName"`    // Project name
	Description    string `json:"description"`    // Project description
	Status         string `json:"status"`         // Normal
	Owner          string `json:"owner"`          // empty
	Region         string `json:"region"`         // region id, eg cn-shanghai
	CreateTime     string `json:"createTime"`     // unix time seconds, eg 1524539357
	LastModifyTime string `json:"lastModifyTime"` // unix time seconds, eg 1524539357

	Endpoint        string // IP or hostname of SLS endpoint
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
	UsingHTTP       bool   // default https
	UserAgent       string // default defaultLogUserAgent
	// contains filtered or unexported fields
}

LogProject defines log project

func NewLogProject

func NewLogProject(name, endpoint, accessKeyID, accessKeySecret string) (p *LogProject, err error)

NewLogProject creates a new SLS project.

func (*LogProject) ApplyConfigToMachineGroup

func (p *LogProject) ApplyConfigToMachineGroup(confName, groupName string) (err error)

ApplyConfigToMachineGroup applies config to machine group.

func (*LogProject) CheckConfigExist

func (p *LogProject) CheckConfigExist(name string) (bool, error)

CheckConfigExist check config exist or not

func (*LogProject) CheckLogstoreExist

func (p *LogProject) CheckLogstoreExist(name string) (bool, error)

CheckLogstoreExist check logstore exist or not

func (*LogProject) CheckMachineGroupExist

func (p *LogProject) CheckMachineGroupExist(name string) (bool, error)

CheckMachineGroupExist check machine group exist or not

func (*LogProject) CreateConfig

func (p *LogProject) CreateConfig(c *LogConfig) (err error)

CreateConfig creates a new config in SLS.

func (*LogProject) CreateConfigString

func (p *LogProject) CreateConfigString(c string) (err error)

CreateConfigString creates a new config in SLS.

func (*LogProject) CreateETLJob

func (p *LogProject) CreateETLJob(j *ETLJob) error

CreateETLJob creates a new ETL job in SLS.

func (*LogProject) CreateEtlMeta

func (p *LogProject) CreateEtlMeta(etlMeta *EtlMeta) (err error)

func (*LogProject) CreateLogStore

func (p *LogProject) CreateLogStore(name string, ttl, shardCnt int, autoSplit bool, maxSplitShard int) error

CreateLogStore creates a new logstore in SLS, where name is logstore name, and ttl is time-to-live(in day) of logs, and shardCnt is the number of shards, and autoSplit is auto split, and maxSplitShard is the max number of shard.

func (*LogProject) CreateLogStoreV2

func (p *LogProject) CreateLogStoreV2(logstore *LogStore) error

CreateLogStoreV2 creates a new logstore in SLS

func (*LogProject) CreateMachineGroup

func (p *LogProject) CreateMachineGroup(m *MachineGroup) error

CreateMachineGroup creates a new machine group in SLS.

func (*LogProject) DeleteConfig

func (p *LogProject) DeleteConfig(name string) (err error)

DeleteConfig deletes a config according by config name.

func (*LogProject) DeleteETLJob

func (p *LogProject) DeleteETLJob(name string) error

DeleteETLJob deletes a job according to job name.

func (*LogProject) DeleteEtlMeta

func (p *LogProject) DeleteEtlMeta(etlMetaName, etlMetaKey string) (err error)

func (*LogProject) DeleteLogStore

func (p *LogProject) DeleteLogStore(name string) (err error)

DeleteLogStore deletes a logstore according by logstore name.

func (*LogProject) DeleteMachineGroup

func (p *LogProject) DeleteMachineGroup(name string) (err error)

DeleteMachineGroup deletes machine group according machine group name.

func (*LogProject) GetAppliedConfigs

func (p *LogProject) GetAppliedConfigs(groupName string) (confNames []string, err error)

GetAppliedConfigs returns applied config names list according machine group name groupName.

func (*LogProject) GetAppliedMachineGroups

func (p *LogProject) GetAppliedMachineGroups(confName string) (groupNames []string, err error)

GetAppliedMachineGroups returns applied machine group names list according config name.

func (*LogProject) GetConfig

func (p *LogProject) GetConfig(name string) (c *LogConfig, err error)

GetConfig returns config according by config name.

func (*LogProject) GetConfigString

func (p *LogProject) GetConfigString(name string) (c string, err error)

GetConfigString returns config according by config name.

func (*LogProject) GetETLJob

func (p *LogProject) GetETLJob(name string) (*ETLJob, error)

GetETLJob returns ETL job according to job name.

func (*LogProject) GetEtlMeta

func (p *LogProject) GetEtlMeta(etlMetaName, etlMetaKey string) (etlMeta *EtlMeta, err error)

func (*LogProject) GetLogStore

func (p *LogProject) GetLogStore(name string) (*LogStore, error)

GetLogStore returns logstore according by logstore name.

func (*LogProject) GetMachineGroup

func (p *LogProject) GetMachineGroup(name string) (m *MachineGroup, err error)

GetMachineGroup retruns machine group according by machine group name.

func (*LogProject) ListConfig

func (p *LogProject) ListConfig(offset, size int) (cfgNames []string, total int, err error)

ListConfig returns config names list and the total number of configs. The offset starts from 0 and the size is the max number of configs could be returned.

func (*LogProject) ListETLJobs

func (p *LogProject) ListETLJobs() ([]string, error)

ListETLJobs returns all job names of project.

func (*LogProject) ListEtlMeta

func (p *LogProject) ListEtlMeta(etlMetaName string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*LogProject) ListEtlMetaName

func (p *LogProject) ListEtlMetaName(offset, size int) (total int, count int, etlMetaNameList []string, err error)

func (*LogProject) ListEtlMetaWithTag

func (p *LogProject) ListEtlMetaWithTag(etlMetaName, etlMetaTag string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*LogProject) ListLogStore

func (p *LogProject) ListLogStore() ([]string, error)

ListLogStore returns all logstore names of project p.

func (*LogProject) ListMachineGroup

func (p *LogProject) ListMachineGroup(offset, size int) (m []string, total int, err error)

ListMachineGroup returns machine group name list and the total number of machine groups. The offset starts from 0 and the size is the max number of machine groups could be returned.

func (*LogProject) RemoveConfigFromMachineGroup

func (p *LogProject) RemoveConfigFromMachineGroup(confName, groupName string) (err error)

RemoveConfigFromMachineGroup removes config from machine group.

func (*LogProject) UpdateConfig

func (p *LogProject) UpdateConfig(c *LogConfig) (err error)

UpdateConfig updates a config.

func (*LogProject) UpdateConfigString

func (p *LogProject) UpdateConfigString(configName, c string) (err error)

UpdateConfigString updates a config.

func (*LogProject) UpdateETLJob

func (p *LogProject) UpdateETLJob(name string, job *ETLJob) error

UpdateETLJob updates an ETL job according to job name, Not all fields of ETLJob can be updated

func (*LogProject) UpdateEtlMeta

func (p *LogProject) UpdateEtlMeta(etlMeta *EtlMeta) (err error)

func (*LogProject) UpdateLogStore

func (p *LogProject) UpdateLogStore(name string, ttl, shardCnt int) (err error)

UpdateLogStore updates a logstore according by logstore name, obviously we can't modify the logstore name itself.

func (*LogProject) UpdateLogStoreV2

func (p *LogProject) UpdateLogStoreV2(logstore *LogStore) (err error)

UpdateLogStoreV2 updates a logstore according by logstore name obviously we can't modify the logstore name itself.

func (*LogProject) UpdateMachineGroup

func (p *LogProject) UpdateMachineGroup(m *MachineGroup) (err error)

UpdateMachineGroup updates a machine group.

func (*LogProject) WithRequestTimeout

func (p *LogProject) WithRequestTimeout(timeout time.Duration) *LogProject

WithRequestTimeout with custom timeout for a request

func (*LogProject) WithRetryTimeout

func (p *LogProject) WithRetryTimeout(timeout time.Duration) *LogProject

WithRetryTimeout with custom timeout for a operation each operation may send one or more HTTP requests in case of retry required.

func (*LogProject) WithToken

func (p *LogProject) WithToken(token string) (*LogProject, error)

WithToken add token parameter

type LogStore

type LogStore struct {
	Name          string `json:"logstoreName"`
	TTL           int    `json:"ttl"`
	ShardCount    int    `json:"shardCount"`
	WebTracking   bool   `json:"enable_tracking"`
	AutoSplit     bool   `json:"autoSplit"`
	MaxSplitShard int    `json:"maxSplitShard"`
	AppendMeta    bool   `json:"appendMeta"`

	CreateTime     uint32 `json:"createTime,omitempty"`
	LastModifyTime uint32 `json:"lastModifyTime,omitempty"`
	// contains filtered or unexported fields
}

LogStore defines LogStore struct

func NewLogStore

func NewLogStore(logStoreName string, project *LogProject) (*LogStore, error)

NewLogStore ...

func (*LogStore) CheckIndexExist

func (s *LogStore) CheckIndexExist() (bool, error)

CheckIndexExist check index exist or not

func (*LogStore) CreateIndex

func (s *LogStore) CreateIndex(index Index) error

CreateIndex ...

func (*LogStore) CreateIndexString

func (s *LogStore) CreateIndexString(indexStr string) error

CreateIndexString ...

func (*LogStore) CreateShipper

func (s *LogStore) CreateShipper(shipper *Shipper) error

CreateShipper ...

func (*LogStore) DeleteIndex

func (s *LogStore) DeleteIndex() error

DeleteIndex ...

func (*LogStore) DeleteShipper

func (s *LogStore) DeleteShipper(shipperName string) error

DeleteShipper ...

func (*LogStore) GetCursor

func (s *LogStore) GetCursor(shardID int, from string) (cursor string, err error)

GetCursor gets log cursor of one shard specified by shardId. The from can be in three form: a) unix timestamp in seccond, b) "begin", c) "end". For more detail please read: https://help.aliyun.com/document_detail/29024.html

func (*LogStore) GetHistograms

func (s *LogStore) GetHistograms(topic string, from int64, to int64, queryExp string) (*GetHistogramsResponse, error)

GetHistograms query logs with [from, to) time range

func (*LogStore) GetIndex

func (s *LogStore) GetIndex() (*Index, error)

GetIndex ...

func (*LogStore) GetIndexString

func (s *LogStore) GetIndexString() (string, error)

GetIndexString ...

func (*LogStore) GetLogs

func (s *LogStore) GetLogs(topic string, from int64, to int64, queryExp string,
	maxLineNum int64, offset int64, reverse bool) (*GetLogsResponse, error)

GetLogs query logs with [from, to) time range

func (*LogStore) GetLogsBytes

func (s *LogStore) GetLogsBytes(shardID int, cursor, endCursor string,
	logGroupMaxCount int) (out []byte, nextCursor string, err error)

GetLogsBytes gets logs binary data from shard specified by shardId according cursor and endCursor. The logGroupMaxCount is the max number of logGroup could be returned. The nextCursor is the next curosr can be used to read logs at next time.

func (*LogStore) GetShipper

func (s *LogStore) GetShipper(shipperName string) (*Shipper, error)

GetShipper ...

func (*LogStore) ListShards

func (s *LogStore) ListShards() (shardIDs []*Shard, err error)

ListShards returns shard id list of this logstore.

func (*LogStore) PostLogStoreLogs

func (s *LogStore) PostLogStoreLogs(lg *LogGroup, hashKey *string) (err error)

PostLogStoreLogs put logs into Shard logstore by hashKey. The callers should transform user logs into LogGroup.

func (*LogStore) PullLogs

func (s *LogStore) PullLogs(shardID int, cursor, endCursor string,
	logGroupMaxCount int) (gl *LogGroupList, nextCursor string, err error)

PullLogs gets logs from shard specified by shardId according cursor and endCursor. The logGroupMaxCount is the max number of logGroup could be returned. The nextCursor is the next cursor can be used to read logs at next time. @note if you want to pull logs continuous, set endCursor = ""

func (*LogStore) PutLogs

func (s *LogStore) PutLogs(lg *LogGroup) (err error)

PutLogs put logs into logstore. The callers should transform user logs into LogGroup.

func (*LogStore) PutRawLog

func (s *LogStore) PutRawLog(rawLogData []byte) (err error)

PutRawLog put raw log data to log service, no marshal

func (*LogStore) SetPutLogCompressType

func (s *LogStore) SetPutLogCompressType(compressType int) error

SetPutLogCompressType set put log's compress type, default lz4

func (*LogStore) UpdateIndex

func (s *LogStore) UpdateIndex(index Index) error

UpdateIndex ...

func (*LogStore) UpdateIndexString

func (s *LogStore) UpdateIndexString(indexStr string) error

UpdateIndexString ...

func (*LogStore) UpdateShipper

func (s *LogStore) UpdateShipper(shipper *Shipper) error

UpdateShipper ...

type LogTag

type LogTag struct {
	Key              *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"`
	Value            *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*LogTag) Descriptor

func (*LogTag) Descriptor() ([]byte, []int)

func (*LogTag) GetKey

func (m *LogTag) GetKey() string

func (*LogTag) GetValue

func (m *LogTag) GetValue() string

func (*LogTag) Marshal

func (m *LogTag) Marshal() (dAtA []byte, err error)

func (*LogTag) MarshalTo

func (m *LogTag) MarshalTo(dAtA []byte) (int, error)

func (*LogTag) ProtoMessage

func (*LogTag) ProtoMessage()

func (*LogTag) Reset

func (m *LogTag) Reset()

func (*LogTag) Size

func (m *LogTag) Size() (n int)

func (*LogTag) String

func (m *LogTag) String() string

func (*LogTag) Unmarshal

func (m *LogTag) Unmarshal(dAtA []byte) error

type MachinGroupAttribute

type MachinGroupAttribute struct {
	ExternalName string `json:"externalName"`
	TopicName    string `json:"groupTopic"`
}

MachinGroupAttribute defines machine group attribute

type Machine

type Machine struct {
	IP            string
	UniqueID      string `json:"machine-uniqueid"`
	UserdefinedID string `json:"userdefined-id"`
}

Machine defines machine struct

type MachineGroup

type MachineGroup struct {
	Name           string               `json:"groupName"`
	Type           string               `json:"groupType"`
	MachineIDType  string               `json:"machineIdentifyType"`
	MachineIDList  []string             `json:"machineList"`
	Attribute      MachinGroupAttribute `json:"groupAttribute"`
	CreateTime     uint32               `json:"createTime,omitempty"`
	LastModifyTime uint32               `json:"lastModifyTime,omitempty"`
}

MachineGroup defines machine group

type MachineList

type MachineList struct {
	Total    int
	Machines []*Machine
}

MachineList defines machine list

type Notification

type Notification struct {
	Type       string   `json:"type"`
	Content    string   `json:"content"`
	EmailList  []string `json:"emailList,omitempty"`
	Method     string   `json:"method,omitempty"`
	MobileList []string `json:"mobileList,omitempty"`
	ServiceUri string   `json:"serviceUri,omitempty"`
}

type OSSShipperConfig

type OSSShipperConfig struct {
	OssBucket      string `json:"ossBucket"`
	OssPrefix      string `json:"ossPrefix"`
	RoleArn        string `json:"roleArn"`
	BufferInterval int    `json:"bufferInterval"`
	BufferSize     int    `json:"bufferSize"`
	CompressType   string `json:"compressType"`
	PathFormat     string `json:"pathFormat"`
	Format         string `json:"format"`
}

type OutputDetail

type OutputDetail struct {
	ProjectName  string `json:"projectName"`
	LogStoreName string `json:"logstoreName"`
}

OutputDetail defines output

type PluginInputItem

type PluginInputItem struct {
	Type   string          `json:"type"`
	Detail PluginInterface `json:"detail"`
}

func CreatePluginInputItem

func CreatePluginInputItem(t string, detail PluginInterface) *PluginInputItem

type PluginInterface

type PluginInterface interface {
}

type PluginLogConfigInputDetail

type PluginLogConfigInputDetail struct {
	CommonConfigInputDetail
	PluginDetail LogConfigPluginInput `json:"plugin"`
}

PluginLogConfigInputDetail plugin log config, eg: docker stdout, binlog, mysql, http...

func ConvertToPluginLogConfigInputDetail

func ConvertToPluginLogConfigInputDetail(detail InputDetailInterface) (*PluginLogConfigInputDetail, bool)

type RegexConfigInputDetail

type RegexConfigInputDetail struct {
	LocalFileConfigInputDetail
	Key           []string `json:"key"`
	LogBeginRegex string   `json:"logBeginRegex"`
	Regex         string   `json:"regex"`
}

RegexConfigInputDetail regex log config

func ConvertToRegexConfigInputDetail

func ConvertToRegexConfigInputDetail(detail InputDetailInterface) (*RegexConfigInputDetail, bool)

type SavedSearch

type SavedSearch struct {
	SavedSearchName string `json:"savedsearchName"`
	SearchQuery     string `json:"searchQuery"`
	Logstore        string `json:"logstore"`
	Topic           string `json:"topic"`
	DisplayName     string `json:"displayName"`
}

SavedSearch ...

type Schedule

type Schedule struct {
	Type     string `json:"type"`
	Interval string `json:"interval"`
}

type SensitiveKey

type SensitiveKey struct {
	Key          string `json:"key"`
	Type         string `json:"type"`
	RegexBegin   string `json:"regex_begin"`
	RegexContent string `json:"regex_content"`
	All          bool   `json:"all"`
	ConstString  string `json:"const"`
}

type Shard

type Shard struct {
	ShardID           int    `json:"shardID"`
	Status            string `json:"status"`
	InclusiveBeginKey string `json:"inclusiveBeginKey"`
	ExclusiveBeginKey string `json:"exclusiveEndKey"`
	CreateTime        int    `json:"createTime"`
}

Shard defines shard struct

type Shipper

type Shipper struct {
	ShipperName            string          `json:"shipperName"`
	TargetType             string          `json:"targetType"`
	RawTargetConfiguration json.RawMessage `json:"targetConfiguration"`

	TargetConfiguration interface{} `json:"-"`
}

func (*Shipper) MarshalJSON

func (s *Shipper) MarshalJSON() ([]byte, error)

func (*Shipper) UnmarshalJSON

func (s *Shipper) UnmarshalJSON(data []byte) error

type SingleHistogram

type SingleHistogram struct {
	Progress string `json:"progress"`
	Count    int64  `json:"count"`
	From     int64  `json:"from"`
	To       int64  `json:"to"`
}

GetHistogramsResponse defines response from GetHistograms call

type SlsLogPackage

type SlsLogPackage struct {
	Data             []byte `protobuf:"bytes,1,req,name=data" json:"data,omitempty"`
	UncompressSize   *int32 `protobuf:"varint,2,opt,name=uncompress_size,json=uncompressSize" json:"uncompress_size,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

func (*SlsLogPackage) Descriptor

func (*SlsLogPackage) Descriptor() ([]byte, []int)

func (*SlsLogPackage) GetData

func (m *SlsLogPackage) GetData() []byte

func (*SlsLogPackage) GetUncompressSize

func (m *SlsLogPackage) GetUncompressSize() int32

func (*SlsLogPackage) Marshal

func (m *SlsLogPackage) Marshal() (dAtA []byte, err error)

func (*SlsLogPackage) MarshalTo

func (m *SlsLogPackage) MarshalTo(dAtA []byte) (int, error)

func (*SlsLogPackage) ProtoMessage

func (*SlsLogPackage) ProtoMessage()

func (*SlsLogPackage) Reset

func (m *SlsLogPackage) Reset()

func (*SlsLogPackage) Size

func (m *SlsLogPackage) Size() (n int)

func (*SlsLogPackage) String

func (m *SlsLogPackage) String() string

func (*SlsLogPackage) Unmarshal

func (m *SlsLogPackage) Unmarshal(dAtA []byte) error

type SlsLogPackageList

type SlsLogPackageList struct {
	Packages         []*SlsLogPackage `protobuf:"bytes,1,rep,name=packages" json:"packages,omitempty"`
	XXX_unrecognized []byte           `json:"-"`
}

func (*SlsLogPackageList) Descriptor

func (*SlsLogPackageList) Descriptor() ([]byte, []int)

func (*SlsLogPackageList) GetPackages

func (m *SlsLogPackageList) GetPackages() []*SlsLogPackage

func (*SlsLogPackageList) Marshal

func (m *SlsLogPackageList) Marshal() (dAtA []byte, err error)

func (*SlsLogPackageList) MarshalTo

func (m *SlsLogPackageList) MarshalTo(dAtA []byte) (int, error)

func (*SlsLogPackageList) ProtoMessage

func (*SlsLogPackageList) ProtoMessage()

func (*SlsLogPackageList) Reset

func (m *SlsLogPackageList) Reset()

func (*SlsLogPackageList) Size

func (m *SlsLogPackageList) Size() (n int)

func (*SlsLogPackageList) String

func (m *SlsLogPackageList) String() string

func (*SlsLogPackageList) Unmarshal

func (m *SlsLogPackageList) Unmarshal(dAtA []byte) error

type SourceConfig

type SourceConfig struct {
	LogstoreName string `json:"logstoreName"`
}

type StreamLogConfigInputDetail

type StreamLogConfigInputDetail struct {
	CommonConfigInputDetail
	Tag string `json:"tag"`
}

StreamLogConfigInputDetail syslog config

func ConvertToStreamLogConfigInputDetail

func ConvertToStreamLogConfigInputDetail(detail InputDetailInterface) (*StreamLogConfigInputDetail, bool)

type TokenAutoUpdateClient

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

func (*TokenAutoUpdateClient) ApplyConfigToMachineGroup

func (c *TokenAutoUpdateClient) ApplyConfigToMachineGroup(project string, confName, groupName string) (err error)

func (*TokenAutoUpdateClient) CheckConfigExist

func (c *TokenAutoUpdateClient) CheckConfigExist(project string, config string) (ok bool, err error)

func (*TokenAutoUpdateClient) CheckLogstoreExist

func (c *TokenAutoUpdateClient) CheckLogstoreExist(project string, logstore string) (ok bool, err error)

func (*TokenAutoUpdateClient) CheckMachineGroupExist

func (c *TokenAutoUpdateClient) CheckMachineGroupExist(project string, machineGroup string) (ok bool, err error)

func (*TokenAutoUpdateClient) CheckProjectExist

func (c *TokenAutoUpdateClient) CheckProjectExist(name string) (ok bool, err error)

func (*TokenAutoUpdateClient) Close

func (c *TokenAutoUpdateClient) Close() error

func (*TokenAutoUpdateClient) CreateAlert

func (c *TokenAutoUpdateClient) CreateAlert(project string, alert *Alert) (err error)

func (*TokenAutoUpdateClient) CreateChart

func (c *TokenAutoUpdateClient) CreateChart(project, dashboardName string, chart Chart) (err error)

func (*TokenAutoUpdateClient) CreateConfig

func (c *TokenAutoUpdateClient) CreateConfig(project string, config *LogConfig) (err error)

func (*TokenAutoUpdateClient) CreateConfigString

func (c *TokenAutoUpdateClient) CreateConfigString(project string, config string) (err error)

func (*TokenAutoUpdateClient) CreateDashboard

func (c *TokenAutoUpdateClient) CreateDashboard(project string, dashboard Dashboard) (err error)

func (*TokenAutoUpdateClient) CreateDashboardString

func (c *TokenAutoUpdateClient) CreateDashboardString(project string, dashboardStr string) (err error)

func (*TokenAutoUpdateClient) CreateEtlMeta

func (c *TokenAutoUpdateClient) CreateEtlMeta(project string, etlMeta *EtlMeta) (err error)

func (*TokenAutoUpdateClient) CreateIndex

func (c *TokenAutoUpdateClient) CreateIndex(project, logstore string, index Index) (err error)

func (*TokenAutoUpdateClient) CreateIndexString

func (c *TokenAutoUpdateClient) CreateIndexString(project, logstore string, index string) (err error)

func (*TokenAutoUpdateClient) CreateLogStore

func (c *TokenAutoUpdateClient) CreateLogStore(project string, logstore string, ttl, shardCnt int, autoSplit bool, maxSplitShard int) (err error)

func (*TokenAutoUpdateClient) CreateLogStoreV2

func (c *TokenAutoUpdateClient) CreateLogStoreV2(project string, logstore *LogStore) (err error)

func (*TokenAutoUpdateClient) CreateMachineGroup

func (c *TokenAutoUpdateClient) CreateMachineGroup(project string, m *MachineGroup) (err error)

func (*TokenAutoUpdateClient) CreateProject

func (c *TokenAutoUpdateClient) CreateProject(name, description string) (prj *LogProject, err error)

func (*TokenAutoUpdateClient) CreateSavedSearch

func (c *TokenAutoUpdateClient) CreateSavedSearch(project string, savedSearch *SavedSearch) (err error)

func (*TokenAutoUpdateClient) DeleteAlert

func (c *TokenAutoUpdateClient) DeleteAlert(project string, alertName string) (err error)

func (*TokenAutoUpdateClient) DeleteChart

func (c *TokenAutoUpdateClient) DeleteChart(project, dashboardName, chartName string) (err error)

func (*TokenAutoUpdateClient) DeleteConfig

func (c *TokenAutoUpdateClient) DeleteConfig(project string, config string) (err error)

func (*TokenAutoUpdateClient) DeleteDashboard

func (c *TokenAutoUpdateClient) DeleteDashboard(project, name string) (err error)

func (*TokenAutoUpdateClient) DeleteEtlMeta

func (c *TokenAutoUpdateClient) DeleteEtlMeta(project string, etlMetaName, etlMetaKey string) (err error)

func (*TokenAutoUpdateClient) DeleteIndex

func (c *TokenAutoUpdateClient) DeleteIndex(project, logstore string) (err error)

func (*TokenAutoUpdateClient) DeleteLogStore

func (c *TokenAutoUpdateClient) DeleteLogStore(project string, logstore string) (err error)

func (*TokenAutoUpdateClient) DeleteMachineGroup

func (c *TokenAutoUpdateClient) DeleteMachineGroup(project string, machineGroup string) (err error)

func (*TokenAutoUpdateClient) DeleteProject

func (c *TokenAutoUpdateClient) DeleteProject(name string) (err error)

func (*TokenAutoUpdateClient) DeleteSavedSearch

func (c *TokenAutoUpdateClient) DeleteSavedSearch(project string, savedSearchName string) (err error)

func (*TokenAutoUpdateClient) DisableAlert

func (c *TokenAutoUpdateClient) DisableAlert(project string, alertName string) (err error)

func (*TokenAutoUpdateClient) EnableAlert

func (c *TokenAutoUpdateClient) EnableAlert(project string, alertName string) (err error)

func (*TokenAutoUpdateClient) GetAlert

func (c *TokenAutoUpdateClient) GetAlert(project string, alertName string) (alert *Alert, err error)

func (*TokenAutoUpdateClient) GetAppliedConfigs

func (c *TokenAutoUpdateClient) GetAppliedConfigs(project string, groupName string) (confNames []string, err error)

func (*TokenAutoUpdateClient) GetAppliedMachineGroups

func (c *TokenAutoUpdateClient) GetAppliedMachineGroups(project string, confName string) (groupNames []string, err error)

func (*TokenAutoUpdateClient) GetChart

func (c *TokenAutoUpdateClient) GetChart(project, dashboardName, chartName string) (chart *Chart, err error)

func (*TokenAutoUpdateClient) GetConfig

func (c *TokenAutoUpdateClient) GetConfig(project string, config string) (logConfig *LogConfig, err error)

func (*TokenAutoUpdateClient) GetConfigString

func (c *TokenAutoUpdateClient) GetConfigString(project string, config string) (logConfig string, err error)

func (*TokenAutoUpdateClient) GetCursor

func (c *TokenAutoUpdateClient) GetCursor(project, logstore string, shardID int, from string) (cursor string, err error)

func (*TokenAutoUpdateClient) GetDashboard

func (c *TokenAutoUpdateClient) GetDashboard(project, name string) (dashboard *Dashboard, err error)

func (*TokenAutoUpdateClient) GetDashboardString

func (c *TokenAutoUpdateClient) GetDashboardString(project, name string) (dashboard string, err error)

func (*TokenAutoUpdateClient) GetEtlMeta

func (c *TokenAutoUpdateClient) GetEtlMeta(project string, etlMetaName, etlMetaKey string) (etlMeta *EtlMeta, err error)

func (*TokenAutoUpdateClient) GetHistograms

func (c *TokenAutoUpdateClient) GetHistograms(project, logstore string, topic string, from int64, to int64, queryExp string) (h *GetHistogramsResponse, err error)

func (*TokenAutoUpdateClient) GetIndex

func (c *TokenAutoUpdateClient) GetIndex(project, logstore string) (index *Index, err error)

func (*TokenAutoUpdateClient) GetIndexString

func (c *TokenAutoUpdateClient) GetIndexString(project, logstore string) (index string, err error)

func (*TokenAutoUpdateClient) GetLogStore

func (c *TokenAutoUpdateClient) GetLogStore(project string, logstore string) (logstoreRst *LogStore, err error)

func (*TokenAutoUpdateClient) GetLogs

func (c *TokenAutoUpdateClient) GetLogs(project, logstore string, topic string, from int64, to int64, queryExp string,
	maxLineNum int64, offset int64, reverse bool) (r *GetLogsResponse, err error)

func (*TokenAutoUpdateClient) GetLogsBytes

func (c *TokenAutoUpdateClient) GetLogsBytes(project, logstore string, shardID int, cursor, endCursor string,
	logGroupMaxCount int) (out []byte, nextCursor string, err error)

func (*TokenAutoUpdateClient) GetMachineGroup

func (c *TokenAutoUpdateClient) GetMachineGroup(project string, machineGroup string) (m *MachineGroup, err error)

func (*TokenAutoUpdateClient) GetProject

func (c *TokenAutoUpdateClient) GetProject(name string) (prj *LogProject, err error)

func (*TokenAutoUpdateClient) GetSavedSearch

func (c *TokenAutoUpdateClient) GetSavedSearch(project string, savedSearchName string) (savedSearch *SavedSearch, err error)

func (*TokenAutoUpdateClient) ListAlert

func (c *TokenAutoUpdateClient) ListAlert(project string, alertName string, dashboard string, offset, size int) (alerts []*Alert, total int, count int, err error)

func (*TokenAutoUpdateClient) ListConfig

func (c *TokenAutoUpdateClient) ListConfig(project string, offset, size int) (cfgNames []string, total int, err error)

func (*TokenAutoUpdateClient) ListDashboard

func (c *TokenAutoUpdateClient) ListDashboard(project string, dashboardName string, offset, size int) (dashboardList []string, count, total int, err error)

func (*TokenAutoUpdateClient) ListEtlMeta

func (c *TokenAutoUpdateClient) ListEtlMeta(project string, etlMetaName string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*TokenAutoUpdateClient) ListEtlMetaName

func (c *TokenAutoUpdateClient) ListEtlMetaName(project string, offset, size int) (total int, count int, etlMetaNameList []string, err error)

func (*TokenAutoUpdateClient) ListEtlMetaWithTag

func (c *TokenAutoUpdateClient) ListEtlMetaWithTag(project string, etlMetaName, etlMetaTag string, offset, size int) (total int, count int, etlMetaList []*EtlMeta, err error)

func (*TokenAutoUpdateClient) ListLogStore

func (c *TokenAutoUpdateClient) ListLogStore(project string) (logstoreList []string, err error)

func (*TokenAutoUpdateClient) ListMachineGroup

func (c *TokenAutoUpdateClient) ListMachineGroup(project string, offset, size int) (m []string, total int, err error)

func (*TokenAutoUpdateClient) ListMachines

func (c *TokenAutoUpdateClient) ListMachines(project, machineGroupName string) (ms []*Machine, total int, err error)

func (*TokenAutoUpdateClient) ListProject

func (c *TokenAutoUpdateClient) ListProject() (projectNames []string, err error)

func (*TokenAutoUpdateClient) ListProjectV2

func (c *TokenAutoUpdateClient) ListProjectV2(offset, size int) (projects []LogProject, count, total int, err error)

func (*TokenAutoUpdateClient) ListSavedSearch

func (c *TokenAutoUpdateClient) ListSavedSearch(project string, savedSearchName string, offset, size int) (savedSearches []string, total int, count int, err error)

func (*TokenAutoUpdateClient) ListShards

func (c *TokenAutoUpdateClient) ListShards(project, logstore string) (shardIDs []*Shard, err error)

func (*TokenAutoUpdateClient) MergeShards

func (c *TokenAutoUpdateClient) MergeShards(project, logstore string, shardID int) (shards []*Shard, err error)

func (*TokenAutoUpdateClient) PostLogStoreLogs

func (c *TokenAutoUpdateClient) PostLogStoreLogs(project, logstore string, lg *LogGroup, hashKey *string) (err error)

func (*TokenAutoUpdateClient) PullLogs

func (c *TokenAutoUpdateClient) PullLogs(project, logstore string, shardID int, cursor, endCursor string,
	logGroupMaxCount int) (gl *LogGroupList, nextCursor string, err error)

func (*TokenAutoUpdateClient) PutLogs

func (c *TokenAutoUpdateClient) PutLogs(project, logstore string, lg *LogGroup) (err error)

func (*TokenAutoUpdateClient) PutLogsWithCompressType

func (c *TokenAutoUpdateClient) PutLogsWithCompressType(project, logstore string, lg *LogGroup, compressType int) (err error)

func (*TokenAutoUpdateClient) PutRawLogWithCompressType

func (c *TokenAutoUpdateClient) PutRawLogWithCompressType(project, logstore string, rawLogData []byte, compressType int) (err error)

PutRawLogWithCompressType put raw log data to log service, no marshal

func (*TokenAutoUpdateClient) RemoveConfigFromMachineGroup

func (c *TokenAutoUpdateClient) RemoveConfigFromMachineGroup(project string, confName, groupName string) (err error)

func (*TokenAutoUpdateClient) ResetAccessKeyToken

func (c *TokenAutoUpdateClient) ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string)

func (*TokenAutoUpdateClient) SplitShard

func (c *TokenAutoUpdateClient) SplitShard(project, logstore string, shardID int, splitKey string) (shards []*Shard, err error)

func (*TokenAutoUpdateClient) UpdateAlert

func (c *TokenAutoUpdateClient) UpdateAlert(project string, alert *Alert) (err error)

func (*TokenAutoUpdateClient) UpdateChart

func (c *TokenAutoUpdateClient) UpdateChart(project, dashboardName string, chart Chart) (err error)

func (*TokenAutoUpdateClient) UpdateConfig

func (c *TokenAutoUpdateClient) UpdateConfig(project string, config *LogConfig) (err error)

func (*TokenAutoUpdateClient) UpdateConfigString

func (c *TokenAutoUpdateClient) UpdateConfigString(project string, configName, configDetail string) (err error)

func (*TokenAutoUpdateClient) UpdateDashboard

func (c *TokenAutoUpdateClient) UpdateDashboard(project string, dashboard Dashboard) (err error)

func (*TokenAutoUpdateClient) UpdateDashboardString

func (c *TokenAutoUpdateClient) UpdateDashboardString(project string, dashboardName, dashboardStr string) (err error)

func (*TokenAutoUpdateClient) UpdateEtlMeta

func (c *TokenAutoUpdateClient) UpdateEtlMeta(project string, etlMeta *EtlMeta) (err error)

func (*TokenAutoUpdateClient) UpdateIndex

func (c *TokenAutoUpdateClient) UpdateIndex(project, logstore string, index Index) (err error)

func (*TokenAutoUpdateClient) UpdateIndexString

func (c *TokenAutoUpdateClient) UpdateIndexString(project, logstore string, index string) (err error)

func (*TokenAutoUpdateClient) UpdateLogStore

func (c *TokenAutoUpdateClient) UpdateLogStore(project string, logstore string, ttl, shardCnt int) (err error)

func (*TokenAutoUpdateClient) UpdateLogStoreV2

func (c *TokenAutoUpdateClient) UpdateLogStoreV2(project string, logstore *LogStore) (err error)

func (*TokenAutoUpdateClient) UpdateMachineGroup

func (c *TokenAutoUpdateClient) UpdateMachineGroup(project string, m *MachineGroup) (err error)

func (*TokenAutoUpdateClient) UpdateSavedSearch

func (c *TokenAutoUpdateClient) UpdateSavedSearch(project string, savedSearch *SavedSearch) (err error)

type TriggerConfig

type TriggerConfig struct {
	MaxRetryTime    int    `json:"maxRetryTime"`
	TriggerInterval int    `json:"triggerInterval"`
	RoleARN         string `json:"roleArn"`
}

type UpdateTokenFunction

type UpdateTokenFunction func() (accessKeyID, accessKeySecret, securityToken string, expireTime time.Time, err error)

Directories

Path Synopsis
example
etl

Jump to

Keyboard shortcuts

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