sls

package module
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 34 Imported by: 190

README

User Guide (中文)

README in English

基本介绍

本项目是阿里云日志服务 (Log Service,简称SLS)API的Golang编程接口,提供了对于Log Service Rest API的封装和实现,帮助Golang开发人员更快编程使用阿里云日志服务。

本项目主要由3个部分组成:

  1. 日志服务基础API封装和实现。
  2. Golang Producer Library,用于向日志服务批量发送数据,详情参考Aliyun LOG Golang Producer 快速入门
  3. Golang Consumer Library,用于消费日志服务中的数据,详情参考Consumer Library

详细API接口以及含义请参考:https://help.aliyun.com/document_detail/29007.html

安装

go get -u github.com/aliyun/aliyun-log-go-sdk

快速入门

前言: 所有的使用样例都位于example目录下,使用该目录下的所有样例前,请先在该目录下的config.go文件中的init函数中配置您的 project, logstore等所需要的配置参数,example目录下的所有样例都会使用config.go文件中配置的参数。

  1. 创建Client

    参考 config.go 文件

    AccessKeyID = "your ak id"
    AccessKeySecret = "your ak secret"
    Endpoint = "your endpoint" // just like cn-hangzhou.log.aliyuncs.com
    Client = sls.CreateNormalInterface(Endpoint,AccessKeyID,AccessKeySecret,"")
    
  2. 创建project

    参考 log_project.go文件

    project, err := util.Client.CreateProject(ProjectName,"Project used for testing")
    if err != nil {
       fmt.Println(err)
    }
    fmt.Println(project)
    
  3. 创建logstore

    参考 log_logstore.go

    err := util.Client.CreateLogStore(ProjectName, LogStoreName,2,2,true,64)
    if err != nil {
       fmt.Println(err)
    }
    
  4. 创建索引

    参考index_sample

    indexKeys := map[string]sls.IndexKey{
       "col_0": {
          Token:         []string{" "},
          CaseSensitive: false,
          Type:          "long",
       },
       "col_1": {
          Token:         []string{",", ":", " "},
          CaseSensitive: false,
          Type:          "text",
       },
    }
    index := sls.Index{
       Keys: indexKeys,
       Line: &sls.IndexLine{
          Token:         []string{",", ":", " "},
          CaseSensitive: false,
          IncludeKeys:   []string{},
          ExcludeKeys:   []string{},
       },
    }
    err = util.Client.CreateIndex(util.ProjectName, logstore_name, index)
    if err != nil {
       fmt.Printf("CreateIndex fail, err: %s", err)
       return
    }
    fmt.Println("CreateIndex success")
    
  5. 写数据

    参考put_log.go

    这里展示了用sdk中原生的API接口去发送数据简单示例,但是我们不推荐用API直接向logstore写入数据,推荐使用SDK 中提供的producer 包向logstore 写入数据,自动压缩数据并且提供安全退出机制,不会使数据丢失。

    logs := []*sls.Log{}
    for logIdx := 0; logIdx < 100; logIdx++ {
       content := []*sls.LogContent{}
       for colIdx := 0; colIdx < 10; colIdx++ {
          content = append(content, &sls.LogContent{
             Key:   proto.String(fmt.Sprintf("col_%d", colIdx)),
             Value: proto.String(fmt.Sprintf("loggroup idx: %d, log idx: %d, col idx: %d, value: %d", loggroupIdx, logIdx, colIdx, rand.Intn(10000000))),
          })
       }
       log := &sls.Log{
          Time:     proto.Uint32(uint32(time.Now().Unix())),
          Contents: content,
       }
       logs = append(logs, log)
    }
    loggroup := &sls.LogGroup{
       Topic:  proto.String(""),
       Source: proto.String("10.230.201.117"),
       Logs:   logs,
    }
    // PostLogStoreLogs API Ref: https://intl.aliyun.com/help/doc-detail/29026.htm
    for retryTimes := 0; retryTimes < 10; retryTimes++ {
       err := util.Client.PutLogs(util.ProjectName, util.LogStoreName, loggroup)
       if err == nil {
          fmt.Printf("PutLogs success, retry: %d\n", retryTimes)
          break
       } else {
          fmt.Printf("PutLogs fail, retry: %d, err: %s\n", retryTimes, err)
          //handle exception here, you can add retryable erorrCode, set appropriate put_retry
          if strings.Contains(err.Error(), sls.WRITE_QUOTA_EXCEED) || strings.Contains(err.Error(), sls.PROJECT_QUOTA_EXCEED) || strings.Contains(err.Error(), sls.SHARD_WRITE_QUOTA_EXCEED) {
             //mayby you should split shard
             time.Sleep(1000 * time.Millisecond)
          } else if strings.Contains(err.Error(), sls.INTERNAL_SERVER_ERROR) || strings.Contains(err.Error(), sls.SERVER_BUSY) {
             time.Sleep(200 * time.Millisecond)
          }
       }
    }
    

6.读数据

参考pull_log.go

这里展示了使用SDK中原生API接口调用去拉取数据的方式,我们不推荐使用这种方式去读取消费logstore中的数据,推荐使用SDK中 consumer 消费组去拉取数据,消费组提供自动负载均衡以及失败重试等机制,并且会自动保存拉取断点,再次拉取不会拉取重复数据。

shards, err := client.ListShards(project, logstore)

totalLogCount := 0
	for _, shard := range shards {
		fmt.Printf("[shard] %d begin\n", shard.ShardID)
		beginCursor, err := client.GetCursor(project, logstore, shard.ShardID, "begin")
		if err != nil {
			panic(err)
		}
		endCursor, err := client.GetCursor(project, logstore, shard.ShardID, "end")
		if err != nil {
			panic(err)
		}

		nextCursor := beginCursor
		for nextCursor != endCursor {
			gl, nc, err := client.PullLogs(project, logstore, shard.ShardID, nextCursor, endCursor, 10)
			if err != nil {
				fmt.Printf("pull log error : %s\n", err)
				time.Sleep(time.Second)
				continue
			}
			nextCursor = nc
			fmt.Printf("now count %d \n", totalLogCount)
			if gl != nil {
				for _, lg := range gl.LogGroups {
					for _, tag := range lg.LogTags {
						fmt.Printf("[tag] %s : %s\n", tag.GetKey(), tag.GetValue())
					}
					for _, log := range lg.Logs {
						totalLogCount++
						// print log
						for _, content := range log.Contents {
							fmt.Printf("[log] %s : %s\n", content.GetKey(), content.GetValue())
						}
					}
				}
			}
		}
  1. 创建机器组

    参考 machine_group_sample.go

机器组分为IP型机器组和标识型机器组,二选一

创建标识型机器组

attribute := sls.MachinGroupAttribute{
}
machineList := []string{"mac-user-defined-id-value_XX"}
var machineGroup = &sls.MachineGroup{
   Name:          groupName,
   MachineIDType: "userdefined",
   MachineIDList: machineList,
   Attribute:     attribute,
}
err = util.Client.CreateMachineGroup(ProjectName, machineGroup)
if err != nil {
   fmt.Println(err)
}

创建IP型机器组

attribute := sls.MachinGroupAttribute{
}
machineList := []string{"192.168.XX.XX"}
var machineGroup = &sls.MachineGroup{
   Name:          groupName,
   MachineIDType: "ip",
   MachineIDList: machineList,
   Attribute:     attribute,
}
err = util.Client.CreateMachineGroup(ProjectName, machineGroup)
if err != nil {
   fmt.Println(err)
}
  1. 创建logtail 采集配置

    logtail 采集配置,目前通过sdk 支持创建下列几种模式的采集配置,分别为 完整正则分隔符模式json模式插件模式,这里展示的完整正则模式的创建。

    regexConfig := new(sls.RegexConfigInputDetail)
    regexConfig.DiscardUnmatch = false
    regexConfig.Key = []string{"logger", "time", "cluster", "hostname", "sr", "app", "workdir", "exe", "corepath", "signature", "backtrace"}
    regexConfig.Regex = "\\S*\\s+(\\S*)\\s+(\\S*\\s+\\S*)\\s+\\S*\\s+(\\S*)\\s+(\\S*)\\s+(\\S*)\\s+(\\S*)\\s+(\\S*)\\s+(\\S*)\\s+(\\S*)\\s+\\S*\\s+(\\S*)\\s*([^$]+)"
    regexConfig.TimeFormat = "%Y/%m/%d %H:%M:%S"
    regexConfig.LogBeginRegex = `INFO core_dump_info_data .*`
    regexConfig.LogPath = "/cloud/log/tianji/TianjiClient#/core_dump_manager"
    regexConfig.FilePattern = "core_dump_info_data.log*"
    regexConfig.MaxDepth = 0
    sls.InitRegexConfigInputDetail(regexConfig)
    outputDetail := sls.OutputDetail{
       ProjectName:  projectName,
       LogStoreName: logstore,
    }
    logConfig := &sls.LogConfig{
       Name:         configName,
       InputType:    "file",
       OutputType:   "LogService", // Now only supports LogService
       InputDetail:  regexConfig,
       OutputDetail: outputDetail,
    }
    err = util.Client.CreateConfig(projectName, logConfig)
    if err != nil {
       fmt.Println(err)
    }
    
  2. logtail配置到机器组

    err = util.Client.ApplyConfigToMachineGroup(ProjectName, confName, mgname)
    if err != nil {
       fmt.Println(err)
    }
    

开发者

更新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 (
	JoinTypeCross        = "cross_join"
	JoinTypeInner        = "inner_join"
	JoinTypeLeft         = "left_join"
	JoinTypeRight        = "right_join"
	JoinTypeFull         = "full_join"
	JoinTypeLeftExclude  = "left_exclude"
	JoinTypeRightExclude = "right_exclude"
	JoinTypeConcat       = "concat"
	JoinTypeNo           = "no_join"
)
View Source
const (
	GroupTypeNoGroup    = "no_group"
	GroupTypeLabelsAuto = "labels_auto"
	GroupTypeCustom     = "custom"
)
View Source
const (
	ScheduleTypeFixedRate = "FixedRate"
	ScheduleTypeHourly    = "Hourly"
	ScheduleTypeDaily     = "Daily"
	ScheduleTypeWeekly    = "Weekly"
	ScheduleTypeCron      = "Cron"
	ScheduleTypeDayRun    = "DryRun"
	ScheduleTypeResident  = "Resident"
)
View Source
const (
	StoreTypeLog    = "log"
	StoreTypeMetric = "metric"
	StoreTypeMeta   = "meta"
)
View Source
const (
	ResourceNameAlertPolicy        = "sls.alert.alert_policy"
	ResourceNameActionPolicy       = "sls.alert.action_policy"
	ResourceNameUser               = "sls.common.user"
	ResourceNameUserGroup          = "sls.common.user_group"
	ResourceNameContentTemplate    = "sls.alert.content_template"
	ResourceNameGlobalConfig       = "sls.alert.global_config"
	ResourceNameWebhookIntegration = "sls.alert.action_webhook"
)
View Source
const (
	DataSourceOSS        DataSourceType = "AliyunOSS"
	DataSourceBSS        DataSourceType = "AliyunBSS"
	DataSourceMaxCompute DataSourceType = "AliyunMaxCompute"
	DataSourceJDBC       DataSourceType = "JDBC"
	DataSourceKafka      DataSourceType = "Kafka"
	DataSourceCMS        DataSourceType = "AliyunCloudMonitor"
	DataSourceGeneral    DataSourceType = "General"

	OSSDataFormatTypeLine          OSSDataFormatType = "Line"
	OSSDataFormatTypeMultiline     OSSDataFormatType = "Multiline"
	OSSDataFormatTypeJSON          OSSDataFormatType = "JSON"
	OSSDataFormatTypeParquet       OSSDataFormatType = "Parquet"
	OSSDataFormatTypeDelimitedText OSSDataFormatType = "DelimitedText"

	KafkaValueTypeText KafkaValueType = "Text"
	KafkaValueTypeJSON KafkaValueType = "JSON"

	KafkaPositionGroupOffsets KafkaPosition = "GROUP_OFFSETS"
	KafkaPositionEarliest     KafkaPosition = "EARLIEST"
	KafkaPositionLatest       KafkaPosition = "LATEST"
	KafkaPositionTimeStamp    KafkaPosition = "TIMESTAMP"

	DataSinkLOG     DataSinkType = "AliyunLOG"
	DataSinkOSS     DataSinkType = "AliyunOSS"
	DataSinkADB     DataSinkType = "AliyunADB"
	DataSinkTSDB    DataSinkType = "AliyunTSDB"
	DataSinkODPS    DataSinkType = "AliyunODPS"
	DataSinkGENERAL DataSinkType = "General"

	OSSContentDetailTypeParquet OSSContentType = "parquet"
	OSSContentDetailTypeORC     OSSContentType = "orc"
	OSSContentDetailTypeCSV     OSSContentType = "csv"
	OSSContentDetailTypeJSON    OSSContentType = "json"

	OSSCompressionTypeNone   OSSCompressionType = "none"
	OSSCompressionTypeZstd   OSSCompressionType = "zstd"
	OSSCompressionTypeGzip   OSSCompressionType = "gzip"
	OSSCompressionTypeSnappy OSSCompressionType = "snappy"

	ExportVersion2 ExportVersion = "v2.0" // new versions of OSSExport, ODPSExport Version property must use this field, otherwise the service may be unavailable or incomplete
)
View Source
const (
	// MetricAggRulesSQL sql type
	MetricAggRulesSQL = "sql"
	// MetricAggRulesPromQL promql type
	MetricAggRulesPromQL = "promql"
)
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"

	GetLogsQueryInfo = "X-Log-Query-Info"
	BodyRawSize      = "X-Log-Bodyrawsize"
	HasSQLHeader     = "x-log-has-sql"
	ETLVersion       = 2
	ETLType          = "ETL"
	ETLSinksType     = "AliyunLOG"
)
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 (
	HTTPHeaderAuthorization    = "Authorization"
	HTTPHeaderContentMD5       = "Content-MD5"
	HTTPHeaderContentType      = "Content-Type"
	HTTPHeaderContentLength    = "Content-Length"
	HTTPHeaderDate             = "Date"
	HTTPHeaderHost             = "Host"
	HTTPHeaderUserAgent        = "User-Agent"
	HTTPHeaderAcsSecurityToken = "x-acs-security-token"
	HTTPHeaderAPIVersion       = "x-log-apiversion"
	HTTPHeaderLogDate          = "x-log-date"
	HTTPHeaderLogContentSha256 = "x-log-content-sha256"
	HTTPHeaderSignatureMethod  = "x-log-signaturemethod"
	HTTPHeaderBodyRawSize      = "x-log-bodyrawsize"
)
View Source
const BAD_REQUEST = "BadRequest"
View Source
const CONFIG_ALREADY_EXIST = "ConfigAlreadyExist"
View Source
const CONFIG_NOT_EXIST = "ConfigNotExist"
View Source
const (
	CountConditionKey = "__count__"
)
View Source
const DefaultLogUserAgent = "golang-sdk-v0.1.0"
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 (
	ISO8601 = "20060102T150405Z"
)
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 (
	LoggingURI = "logging"
)
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 ResourceTypeUserDefine = "userdefine"
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 GlobalDebugLevel = 0
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 Logger = initDefaultSLSLogger()
View Source
var MaxCompletedRetryCount = 20
View Source
var MaxCompletedRetryLatency = 5 * time.Minute
View Source
var NoConfigFieldError = errors.New("no this config field")
View Source
var RetryOnServerErrorEnabled = true

RetryOnServerErrorEnabled if RetryOnServerErrorEnabled is false, then all error requests will not be retried

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 GenResourceId added in v0.1.46

func GenResourceId(project string, subResourceId string) string

GenResourceId generate the resource id to tag (not used for project)

func GenerateInnerLogger added in v0.1.6

func GenerateInnerLogger(logFileName, isJsonType, logMaxSize, logFileBackupCount, allowLogLevel string) log.Logger

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 IsDebugLevelMatched added in v0.1.6

func IsDebugLevelMatched(level int) bool

func IsTokenError

func IsTokenError(err error) bool

func IsValidInputType

func IsValidInputType(inputType string) bool

IsValidInputType check if specific inputType is valid

func JsonMarshal added in v0.1.22

func JsonMarshal(v interface{}) string

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"`
	Status           string              `json:"status"`
	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"`
	MuteUntil        int64           `json:"muteUntil,omitempty"`
	NotificationList []*Notification `json:"notificationList"`
	NotifyThreshold  int32           `json:"notifyThreshold"`
	Throttling       string          `json:"throttling"`

	Version               string                 `json:"version"`
	Type                  string                 `json:"type"`
	TemplateConfiguration *TemplateConfiguration `json:"templateConfiguration"`

	Dashboard              string                   `json:"dashboard"`
	Threshold              int                      `json:"threshold"`
	NoDataFire             bool                     `json:"noDataFire"`
	NoDataSeverity         Severity                 `json:"noDataSeverity"`
	SendResolved           bool                     `json:"sendResolved"`
	QueryList              []*AlertQuery            `json:"queryList"`
	Annotations            []*Tag                   `json:"annotations"`
	Labels                 []*Tag                   `json:"labels"`
	SeverityConfigurations []*SeverityConfiguration `json:"severityConfigurations"`

	JoinConfigurations []*JoinConfiguration `json:"joinConfigurations"`
	GroupConfiguration GroupConfiguration   `json:"groupConfiguration"`

	PolicyConfiguration PolicyConfiguration `json:"policyConfiguration"`
	AutoAnnotation      bool                `json:"autoAnnotation"`

	Tags []string `json:"tags,omitempty"`
}

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"`

	StoreType    string       `json:"storeType"`
	Project      string       `json:"project"`
	Store        string       `json:"store"`
	Region       string       `json:"region"`
	RoleArn      string       `json:"roleArn"`
	DashboardId  string       `json:"dashboardId"`
	PowerSqlMode PowerSqlMode `json:"powerSqlMode"`
}

type AliyunBssSource added in v0.1.28

type AliyunBssSource struct {
	DataSource
	RoleArn      string `json:"roleARN"`
	HistoryMonth int64  `json:"historyMonth"`
}

ingestion JDBC source

type AliyunCloudMonitorSource added in v0.1.28

type AliyunCloudMonitorSource struct {
	DataSource
	AccessKeyID     string   `json:"accessKeyID"`
	AccessKeySecret string   `json:"accessKeySecret"`
	StartTime       int64    `json:"startTime"`
	Namespaces      []string `json:"namespaces"`
	OutputType      string   `json:"outputType"`
	DelayTime       int64    `json:"delayTime"`
}

ingestion cloud monitor source

type AliyunGeneralSink added in v0.1.30

type AliyunGeneralSink struct {
	Type   DataSinkType           `json:"type"`
	Fields map[string]interface{} `json:"fields"`
}

func (*AliyunGeneralSink) DataSinkType added in v0.1.30

func (_ *AliyunGeneralSink) DataSinkType() DataSinkType

type AliyunMaxComputeSource added in v0.1.28

type AliyunMaxComputeSource struct {
	DataSource
	AccessKeyID     string `json:"accessKeyID"`
	AccessKeySecret string `json:"accessKeySecret"`
	Endpoint        string `json:"endpoint"`
	TunnelEndpoint  string `json:"tunnelEndpoint,omitempty"`
	Project         string `json:"project"`
	Table           string `json:"table"`
	PartitionSpec   string `json:"partitionSpec"`
	TimeField       string `json:"timeField"`
	TimeFormat      string `json:"timeFormat"`
	TimeZone        string `json:"timeZone"`
}

ingestion maxcompute source >>>

type AliyunODPSSink added in v0.1.30

type AliyunODPSSink struct {
	Type                DataSinkType `json:"type"`
	OdpsRolearn         string       `json:"odpsRolearn"`
	OdpsEndpoint        string       `json:"odpsEndpoint"`
	OdpsTunnelEndpoint  string       `json:"odpsTunnelEndpoint"`
	OdpsProject         string       `json:"odpsProject"`
	OdpsTable           string       `json:"odpsTable"`
	TimeZone            string       `json:"timeZone"`
	PartitionTimeFormat string       `json:"partitionTimeFormat"`
	Fields              []string     `json:"fields"`
	PartitionColumn     []string     `json:"partitionColumn"`
	OdpsAccessKeyId     string       `json:"odpsAccessKeyId"`
	OdpsAccessSecret    string       `json:"odpsAccessAecret"`
}

func (*AliyunODPSSink) DataSinkType added in v0.1.30

func (_ *AliyunODPSSink) DataSinkType() DataSinkType

type AliyunOSSSink added in v0.1.30

type AliyunOSSSink struct {
	Type            DataSinkType       `json:"type"`
	RoleArn         string             `json:"roleArn"`
	Bucket          string             `json:"bucket"`
	Prefix          string             `json:"prefix"`
	Suffix          string             `json:"suffix"`
	PathFormat      string             `json:"pathFormat"`
	PathFormatType  string             `json:"pathFormatType"`
	BufferSize      int64              `json:"bufferSize"`
	BufferInterval  int64              `json:"bufferInterval"`
	TimeZone        string             `json:"timeZone"`
	ContentType     OSSContentType     `json:"contentType"`
	CompressionType OSSCompressionType `json:"compressionType"`
	//CsvContentDetail, JsonContentDetail, ParquetContentDetail, OrcContentDetail
	// the old version ContentDetail is st  ring(struct serialized string), and now we highly recommend you use the struct ContentDetail directly
	ContentDetail interface{} `json:"contentDetail"`
}

func (*AliyunOSSSink) DataSinkType added in v0.1.30

func (_ *AliyunOSSSink) DataSinkType() DataSinkType

type AliyunOSSSource added in v0.1.28

type AliyunOSSSource struct {
	DataSource
	Bucket                  string      `json:"bucket"`
	Endpoint                string      `json:"endpoint"`
	RoleArn                 string      `json:"roleARN"`
	Prefix                  string      `json:"prefix,omitempty"`
	Pattern                 string      `json:"pattern,omitempty"`
	CompressionCodec        string      `json:"compressionCodec,omitempty"`
	Encoding                string      `json:"encoding,omitempty"`
	Format                  interface{} `json:"format,omitempty"`
	RestoreObjectEnable     bool        `json:"restoreObjectEnable"`
	LastModifyTimeAsLogTime bool        `json:"lastModifyTimeAsLogTime"`
}

type ApsaraLogConfigInputDetail

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

ApsaraLogConfigInputDetail apsara log config

func ConvertToApsaraLogConfigInputDetail

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

type AuthVersionType added in v0.1.42

type AuthVersionType string

AuthVersionType the version of auth

const (
	// AuthV1 v1
	AuthV1 AuthVersionType = "v1"
	// AuthV4 v4
	AuthV4 AuthVersionType = "v4"
)

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 BaseJob added in v0.1.28

type BaseJob struct {
	Name           string  `json:"name"`
	DisplayName    string  `json:"displayName,omitempty"`
	Description    string  `json:"description,omitempty"`
	Type           JobType `json:"type"`
	Recyclable     bool    `json:"recyclable"`
	CreateTime     int64   `json:"createTime"`
	LastModifyTime int64   `json:"lastModifyTime"`
}

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   float64  `json:"xPos"`
	YPosition   float64  `json:"yPos"`
	Width       float64  `json:"width"`
	Height      float64  `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
	RequestTimeOut  time.Duration
	RetryTimeOut    time.Duration
	HTTPClient      *http.Client
	Region          string
	AuthVersion     AuthVersionType //  v1 or v4 signature,default is v1
	// 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) CreateAlertString added in v0.1.19

func (c *Client) CreateAlertString(project string, alert string) 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) CreateETL added in v0.1.16

func (c *Client) CreateETL(project string, etljob ETL) error

func (*Client) CreateEtlMeta

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

func (*Client) CreateExport added in v0.1.30

func (c *Client) CreateExport(project string, export *Export) 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) CreateIngestion added in v0.1.28

func (c *Client) CreateIngestion(project string, ingestion *Ingestion) error

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) CreateLogging added in v0.1.7

func (c *Client) CreateLogging(project string, detail *Logging) error

func (*Client) CreateMachineGroup

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

CreateMachineGroup creates a new machine group in SLS.

func (*Client) CreateMetricAggRules added in v0.1.19

func (c *Client) CreateMetricAggRules(project string, aggRules *MetricAggRules) error

func (*Client) CreateMetricStore added in v0.1.37

func (c *Client) CreateMetricStore(project string, metricStore *LogStore) error

CreateMetricStore .

func (*Client) CreateProject

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

CreateProject create a new loghub project.

func (*Client) CreateResource added in v0.1.22

func (c *Client) CreateResource(resource *Resource) error

func (*Client) CreateResourceRecord added in v0.1.22

func (c *Client) CreateResourceRecord(resourceName string, record *ResourceRecord) error

func (*Client) CreateResourceRecordString added in v0.1.22

func (c *Client) CreateResourceRecordString(resourceName, recordStr string) error

func (*Client) CreateResourceString added in v0.1.22

func (c *Client) CreateResourceString(resourceStr string) error

func (*Client) CreateSavedSearch

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

func (*Client) CreateScheduledSQL added in v0.1.22

func (c *Client) CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) error

func (*Client) CreateSubStore added in v0.1.9

func (c *Client) CreateSubStore(project, logstore string, sss *SubStore) (err error)

CreateSubStore ...

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) DeleteETL added in v0.1.16

func (c *Client) DeleteETL(project string, etlName string) error

func (*Client) DeleteEtlMeta

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

func (*Client) DeleteExport added in v0.1.30

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

func (*Client) DeleteIndex

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

DeleteIndex ...

func (*Client) DeleteIngestion added in v0.1.28

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

func (*Client) DeleteLogStore

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

DeleteLogStore deletes a logstore according by logstore name.

func (*Client) DeleteLogging added in v0.1.7

func (c *Client) DeleteLogging(project string) error

func (*Client) DeleteMachineGroup

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

DeleteMachineGroup deletes machine group according machine group name.

func (*Client) DeleteMetricAggRules added in v0.1.19

func (c *Client) DeleteMetricAggRules(project string, ruleID string) error

func (*Client) DeleteMetricStore added in v0.1.37

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

DeleteMetricStore .

func (*Client) DeleteProject

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

DeleteProject ...

func (*Client) DeleteProjectPolicy added in v0.1.39

func (c *Client) DeleteProjectPolicy(project string) error

func (*Client) DeleteResource added in v0.1.22

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

func (*Client) DeleteResourceRecord added in v0.1.22

func (c *Client) DeleteResourceRecord(resourceName, recordId string) error

func (*Client) DeleteSavedSearch

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

func (*Client) DeleteScheduledSQL added in v0.1.22

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

func (*Client) DeleteSubStore added in v0.1.9

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

DeleteSubStore ...

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) GetAlertString added in v0.1.19

func (c *Client) GetAlertString(project string, alertName string) (string, 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) GetETL added in v0.1.16

func (c *Client) GetETL(project string, etlName string) (ETLJob *ETL, err error)

func (*Client) GetEtlMeta

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

func (*Client) GetExport added in v0.1.30

func (c *Client) GetExport(project, name string) (*Export, 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) GetHistogramsToCompleted added in v0.1.41

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

GetHistogramsToCompleted query logs with [from, to) time range to completed

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) GetIngestion added in v0.1.28

func (c *Client) GetIngestion(project string, name string) (*Ingestion, error)

func (*Client) GetLogLines added in v0.1.17

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

GetLogLines ...

func (*Client) GetLogLinesV2 added in v0.1.24

func (c *Client) GetLogLinesV2(project, logstore string, req *GetLogRequest) (*GetLogLinesResponse, error)

GetLogLinesV2 ...

func (*Client) GetLogStore

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

GetLogStore returns logstore according by logstore name.

func (*Client) GetLogging added in v0.1.7

func (c *Client) GetLogging(project string) (*Logging, error)

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) GetLogsToCompleted added in v0.1.41

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

GetLogsToCompleted query logs with [from, to) time range to completed

func (*Client) GetLogsToCompletedV2 added in v0.1.41

func (c *Client) GetLogsToCompletedV2(project, logstore string, req *GetLogRequest) (*GetLogsResponse, error)

GetLogsToCompletedV2 ...

func (*Client) GetLogsV2 added in v0.1.24

func (c *Client) GetLogsV2(project, logstore string, req *GetLogRequest) (*GetLogsResponse, error)

GetLogsV2 ...

func (*Client) GetLogsV3 added in v0.1.45

func (c *Client) GetLogsV3(project, logstore string, req *GetLogRequest) (*GetLogsV3Response, error)

GetLogsV3 ...

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) GetMetricAggRules added in v0.1.19

func (c *Client) GetMetricAggRules(project string, ruleID string) (*MetricAggRules, error)

func (*Client) GetMetricStore added in v0.1.37

func (c *Client) GetMetricStore(project, name string) (*LogStore, error)

GetMetricStore .

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) GetProjectPolicy added in v0.1.39

func (c *Client) GetProjectPolicy(project string) (policy string, err error)

func (*Client) GetResource added in v0.1.22

func (c *Client) GetResource(name string) (resource *Resource, err error)

func (*Client) GetResourceRecord added in v0.1.22

func (c *Client) GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error)

func (*Client) GetResourceRecordString added in v0.1.22

func (c *Client) GetResourceRecordString(resourceName, recordId string) (recordStr string, err error)

func (*Client) GetResourceString added in v0.1.22

func (c *Client) GetResourceString(name string) (resource string, err error)

func (*Client) GetSavedSearch

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

func (*Client) GetScheduledSQL added in v0.1.22

func (c *Client) GetScheduledSQL(project string, name string) (*ScheduledSQL, error)

func (*Client) GetScheduledSQLJobInstance added in v0.1.22

func (c *Client) GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (*ScheduledSQLJobInstance, error)

func (*Client) GetSubStore added in v0.1.9

func (c *Client) GetSubStore(project, logstore, name string) (sortedSubStore *SubStore, err error)

GetSubStore ...

func (*Client) GetSubStoreTTL added in v0.1.9

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

GetSubStoreTTL ...

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) ListDashboardV2 added in v0.1.14

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

func (*Client) ListETL added in v0.1.16

func (c *Client) ListETL(project string, offset int, size int) (*ListETLResponse, 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) ListExport added in v0.1.30

func (c *Client) ListExport(project, logstore, name, displayName string, offset, size int) (exports []*Export, total, count int, error error)

func (*Client) ListIngestion added in v0.1.28

func (c *Client) ListIngestion(project, logstore, name, displayName string, offset, size int) (ingestions []*Ingestion, total, count int, error error)

func (*Client) ListLogStore

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

ListLogStore returns all logstore names of project p.

func (*Client) ListLogStoreV2 added in v0.1.9

func (c *Client) ListLogStoreV2(project string, offset, size int, telemetryType string) ([]string, error)

ListLogStoreV2 list logstores with params :

offset: start offset
size: max return size
telemetryType : telemetry type filter

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) ListMetricAggRules added in v0.1.19

func (c *Client) ListMetricAggRules(project string, offset int, size int) ([]*MetricAggRules, 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) ListResource added in v0.1.22

func (c *Client) ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error)

func (*Client) ListResourceRecord added in v0.1.22

func (c *Client) ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error)

func (*Client) ListSavedSearch

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

func (*Client) ListSavedSearchV2 added in v0.1.14

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

func (*Client) ListScheduledSQL added in v0.1.22

func (c *Client) ListScheduledSQL(project, name, displayName string, offset, size int) (scheduledsqls []*ScheduledSQL, total, count int, error error)

func (*Client) ListScheduledSQLJobInstances added in v0.1.22

func (c *Client) ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, 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) ListSubStore added in v0.1.9

func (c *Client) ListSubStore(project, logstore string) (sortedSubStores []string, err error)

ListSubStore ...

func (*Client) ListTagResources added in v0.1.13

func (c *Client) ListTagResources(project string,
	resourceType string,
	resourceIDs []string,
	tags []ResourceFilterTag,
	nextToken string) (respTags []*ResourceTagResponse, respNextToken string, err error)

ListTagResources list rag resources

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) ModifyScheduledSQLJobInstanceState added in v0.1.22

func (c *Client) ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) error

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) PublishAlertEvent added in v0.1.43

func (c *Client) PublishAlertEvent(project string, alertResult []byte) error

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) RestartETL added in v0.1.39

func (c *Client) RestartETL(project string, etljob ETL) error

func (*Client) RestartExport added in v0.1.38

func (c *Client) RestartExport(project string, export *Export) error

func (*Client) SetAuthVersion added in v0.1.42

func (c *Client) SetAuthVersion(version AuthVersionType)

SetAuthVersion set signature version that the client used

func (*Client) SetHTTPClient added in v0.1.31

func (c *Client) SetHTTPClient(client *http.Client)

SetHTTPClient set a custom http client, all request will send to sls by this client

func (*Client) SetRegion added in v0.1.42

func (c *Client) SetRegion(region string)

SetRegion set a region, must be set if using signature version v4

func (*Client) SetUserAgent added in v0.1.34

func (c *Client) SetUserAgent(userAgent string)

SetUserAgent set a custom userAgent

func (*Client) SplitNumShard added in v0.1.38

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

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

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) StartETL added in v0.1.16

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

func (*Client) StopETL added in v0.1.16

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

func (*Client) TagResources added in v0.1.13

func (c *Client) TagResources(project string, tags *ResourceTags) error

TagResources tag specific resource

func (*Client) UnTagResources added in v0.1.13

func (c *Client) UnTagResources(project string, tags *ResourceUnTags) error

UnTagResources untag specific resource

func (*Client) UpdateAlert

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

func (*Client) UpdateAlertString added in v0.1.19

func (c *Client) UpdateAlertString(project string, alertName, alert string) 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) UpdateETL added in v0.1.16

func (c *Client) UpdateETL(project string, etljob ETL) error

func (*Client) UpdateEtlMeta

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

func (*Client) UpdateExport added in v0.1.30

func (c *Client) UpdateExport(project string, export *Export) 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) UpdateIngestion added in v0.1.28

func (c *Client) UpdateIngestion(project string, ingestion *Ingestion) error

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) UpdateLogging added in v0.1.7

func (c *Client) UpdateLogging(project string, detail *Logging) error

func (*Client) UpdateMachineGroup

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

UpdateMachineGroup updates a machine group.

func (*Client) UpdateMetricAggRules added in v0.1.19

func (c *Client) UpdateMetricAggRules(project string, aggRules *MetricAggRules) error

func (*Client) UpdateMetricStore added in v0.1.37

func (c *Client) UpdateMetricStore(project string, metricStore *LogStore) error

UpdateMetricStore .

func (*Client) UpdateProject

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

UpdateProject create a new loghub project.

func (*Client) UpdateProjectPolicy added in v0.1.39

func (c *Client) UpdateProjectPolicy(project string, policy string) error

func (*Client) UpdateResource added in v0.1.22

func (c *Client) UpdateResource(resource *Resource) error

func (*Client) UpdateResourceRecord added in v0.1.22

func (c *Client) UpdateResourceRecord(resourceName string, record *ResourceRecord) error

func (*Client) UpdateResourceRecordString added in v0.1.22

func (c *Client) UpdateResourceRecordString(resourceName, recordStr string) error

func (*Client) UpdateResourceString added in v0.1.22

func (c *Client) UpdateResourceString(resourceName, resourceStr string) error

func (*Client) UpdateSavedSearch

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

func (*Client) UpdateScheduledSQL added in v0.1.22

func (c *Client) UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) error

func (*Client) UpdateSubStore added in v0.1.9

func (c *Client) UpdateSubStore(project, logstore string, sss *SubStore) (err error)

UpdateSubStore ...

func (*Client) UpdateSubStoreTTL added in v0.1.9

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

UpdateSubStoreTTL ...

type ClientInterface

type ClientInterface interface {
	// SetUserAgent set userAgent for sls client
	SetUserAgent(userAgent string)
	// SetHTTPClient set a custom http client, all request will send to sls by this client
	SetHTTPClient(client *http.Client)
	// #################### Client Operations #####################
	// ResetAccessKeyToken reset client's access key token
	ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string)
	// SetRegion Set region for signature v4
	SetRegion(region string)
	// SetAuthVersion Set signature version
	SetAuthVersion(version AuthVersionType)
	// Close the client
	Close() error

	// #################### Project Operations #####################
	// CreateProject create a new loghub project.
	CreateProject(name, description string) (*LogProject, error)
	GetProject(name string) (*LogProject, error)
	// UpdateProject create a new loghub project.
	UpdateProject(name, description 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)

	// #################### MetricStore Operations #####################
	// CreateMetricStore creates a new metric store in SLS.
	CreateMetricStore(project string, metricStore *LogStore) error
	// UpdateMetricStore updates a metric store.
	UpdateMetricStore(project string, metricStore *LogStore) error
	// DeleteMetricStore deletes a metric store.
	DeleteMetricStore(project, name string) error
	// GetMetricStore return a metric store.
	GetMetricStore(project, name string) (*LogStore, 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 #####################
	CreateETL(project string, etljob ETL) error
	UpdateETL(project string, etljob ETL) error
	GetETL(project string, etlName string) (ETLJob *ETL, err error)
	ListETL(project string, offset int, size int) (*ListETLResponse, error)
	DeleteETL(project string, etlName string) error
	StartETL(project, name string) error
	StopETL(project, name string) error
	RestartETL(project string, etljob ETL) error

	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)
	// SplitNumShard https://help.aliyun.com/document_detail/29021.html,
	SplitNumShard(project, logstore string, shardID, shardsNum int) (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)
	// GetCursorTime gets the server time based on the cursor.
	// For more detail please read: https://help.aliyun.com/document_detail/113274.html
	GetCursorTime(project, logstore string, shardID int, cursor string) (cursorTime time.Time, 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)
	GetLogLines(project, logstore string, topic string, from int64, to int64, queryExp string,
		maxLineNum int64, offset int64, reverse bool) (*GetLogLinesResponse, error)

	GetLogsV2(project, logstore string, req *GetLogRequest) (*GetLogsResponse, error)
	GetLogLinesV2(project, logstore string, req *GetLogRequest) (*GetLogLinesResponse, error)
	GetLogsV3(project, logstore string, req *GetLogRequest) (*GetLogsV3Response, error)

	// GetHistogramsToCompleted query logs with [from, to) time range to completed
	GetHistogramsToCompleted(project, logstore string, topic string, from int64, to int64, queryExp string) (*GetHistogramsResponse, error)
	// GetLogsToCompleted query logs with [from, to) time range to completed
	GetLogsToCompleted(project, logstore string, topic string, from int64, to int64, queryExp string, maxLineNum int64, offset int64, reverse bool) (*GetLogsResponse, error)
	// GetLogsToCompletedV2 query logs with [from, to) time range to completed
	GetLogsToCompletedV2(project, logstore string, req *GetLogRequest) (*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)
	ListDashboardV2(project string, dashboardName string, offset, size int) (dashboardList []string, dashboardItems []ResponseDashboardItem, 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)
	ListSavedSearchV2(project string, savedSearchName string, offset, size int) (savedSearches []string, savedsearchItems []ResponseSavedSearchItem, 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)
	CreateAlertString(project string, alert string) error
	UpdateAlertString(project string, alertName, alert string) error
	GetAlertString(project string, alertName string) (string, error)

	// #################### Consumer Operations #####################
	CreateConsumerGroup(project, logstore string, cg ConsumerGroup) (err error)
	UpdateConsumerGroup(project, logstore string, cg ConsumerGroup) (err error)
	DeleteConsumerGroup(project, logstore string, cgName string) (err error)
	ListConsumerGroup(project, logstore string) (cgList []*ConsumerGroup, err error)
	HeartBeat(project, logstore string, cgName, consumer string, heartBeatShardIDs []int) (shardIDs []int, err error)
	UpdateCheckpoint(project, logstore string, cgName string, consumer string, shardID int, checkpoint string, forceSuccess bool) (err error)
	GetCheckpoint(project, logstore string, cgName string) (checkPointList []*ConsumerGroupCheckPoint, err error)

	// ####################### Resource Tags API ######################
	// TagResources tag specific resource
	TagResources(project string, tags *ResourceTags) error
	// UnTagResources untag specific resource
	UnTagResources(project string, tags *ResourceUnTags) error
	// ListTagResources list rag resources
	ListTagResources(project string,
		resourceType string,
		resourceIDs []string,
		tags []ResourceFilterTag,
		nextToken string) (respTags []*ResourceTagResponse, respNextToken string, err error)
	CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) error
	DeleteScheduledSQL(project string, name string) error
	UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) error
	GetScheduledSQL(project string, name string) (*ScheduledSQL, error)
	ListScheduledSQL(project, name, displayName string, offset, size int) ([]*ScheduledSQL, int, int, error)
	GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (instance *ScheduledSQLJobInstance, err error)
	ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) error
	ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, err error)

	// #################### Resource Operations #####################
	ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error)
	GetResource(name string) (resource *Resource, err error)
	GetResourceString(name string) (resource string, err error)
	DeleteResource(name string) error
	UpdateResource(resource *Resource) error
	UpdateResourceString(resourceName, resourceStr string) error
	CreateResource(resource *Resource) error
	CreateResourceString(resourceStr string) error

	// #################### Resource Record Operations #####################
	ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error)
	GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error)
	GetResourceRecordString(resourceName, name string) (record string, err error)
	DeleteResourceRecord(resourceName, recordId string) error
	UpdateResourceRecord(resourceName string, record *ResourceRecord) error
	UpdateResourceRecordString(resourceName, recordStr string) error
	CreateResourceRecord(resourceName string, record *ResourceRecord) error
	CreateResourceRecordString(resourceName, recordStr string) error

	// #################### Ingestion #####################
	CreateIngestion(project string, ingestion *Ingestion) error
	UpdateIngestion(project string, ingestion *Ingestion) error
	GetIngestion(project string, name string) (*Ingestion, error)
	ListIngestion(project, logstore, name, displayName string, offset, size int) (ingestions []*Ingestion, total, count int, error error)
	DeleteIngestion(project string, name string) error

	// #################### Export #####################
	CreateExport(project string, export *Export) error
	UpdateExport(project string, export *Export) error
	GetExport(project, name string) (*Export, error)
	ListExport(project, logstore, name, displayName string, offset, size int) (exports []*Export, total, count int, error error)
	DeleteExport(project string, name string) error
	RestartExport(project string, export *Export) error

	// UpdateProjectPolicy updates project's policy.
	UpdateProjectPolicy(project string, policy string) error
	// DeleteProjectPolicy deletes project's policy.
	DeleteProjectPolicy(project string) error
	// GetProjectPolicy return project's policy.
	GetProjectPolicy(project string) (string, error)

	// #################### AlertPub Msg  #####################
	PublishAlertEvent(project string, alertResult []byte) 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 Column added in v0.1.30

type Column struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type ColumnStorageContentDetail added in v0.1.30

type ColumnStorageContentDetail struct {
	Columns []Column `json:"columns"`
}

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 ConditionConfiguration added in v0.1.22

type ConditionConfiguration struct {
	Condition      string `json:"condition"`
	CountCondition string `json:"countCondition"`
}

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

func (*ConsumerGroup) String added in v0.1.44

func (cg *ConsumerGroup) String() string

type ConsumerGroupCheckPoint

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

ConsumerGroupCheckPoint type define

type CsvContentDetail added in v0.1.30

type CsvContentDetail struct {
	ColumnNames []string `json:"columns"`
	Delimiter   string   `json:"delimiter"`
	Quote       string   `json:"quote"`
	Escape      string   `json:"escape"`
	Null        string   `json:"null"`
	Header      bool     `json:"header"`
	LineFeed    string   `json:"lineFeed"`
}

type Dashboard

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

type DataFormat added in v0.1.22

type DataFormat string
const (
	LOG_TO_LOG       DataFormat = "log2log"
	LOG_TO_METRIC    DataFormat = "log2metric"
	METRIC_TO_metric DataFormat = "metric2metric"
)

type DataSink added in v0.1.30

type DataSink interface {
	DataSinkType() DataSinkType
}

type DataSinkType added in v0.1.30

type DataSinkType string

type DataSource added in v0.1.28

type DataSource struct {
	DataSourceType DataSourceType `json:"type"`
}

type DataSourceType added in v0.1.28

type DataSourceType string

type DelimitedTextFormat added in v0.1.28

type DelimitedTextFormat struct {
	StructureDataFormat
	FieldNames       []string `json:"fieldNames"`
	FieldDelimiter   string   `json:"fieldDelimiter"`
	QuoteChar        string   `json:"quoteChar"`
	EscapeChar       string   `json:"escapeChar"`
	SkipLeadingRows  int64    `json:"skipLeadingRows"`
	MaxLines         int64    `json:"maxLines"`
	FirstRowAsHeader bool     `json:"firstRowAsHeader"`
}

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"`
	AcceptNoEnoughKeys bool     `json:"acceptNoEnoughKeys"`
}

DelimiterConfigInputDetail delimiter log config

func ConvertToDelimiterConfigInputDetail

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

type ETL added in v0.1.16

type ETL struct {
	Configuration    ETLConfiguration `json:"configuration"`
	Description      string           `json:"description,omitempty"`
	DisplayName      string           `json:"displayName"`
	Name             string           `json:"name"`
	Schedule         ETLSchedule      `json:"schedule"`
	Type             string           `json:"type"`
	Status           string           `json:"status"`
	CreateTime       int32            `json:"createTime,omitempty"`
	LastModifiedTime int32            `json:"lastModifiedTime,omitempty"`
}

func NewETL added in v0.1.16

func NewETL(endpoint, accessKeyId, accessKeySecret, logstore, name, project string) ETL

type ETLConfiguration added in v0.1.16

type ETLConfiguration struct {
	AccessKeyId     string            `json:"accessKeyId"`
	AccessKeySecret string            `json:"accessKeySecret"`
	FromTime        int64             `json:"fromTime,omitempty"`
	Logstore        string            `json:"logstore"`
	Parameters      map[string]string `json:"parameters,omitempty"`
	RoleArn         string            `json:"roleArn,omitempty"`
	Script          string            `json:"script"`
	ToTime          int32             `json:"toTime,omitempty"`
	Version         int8              `json:"version"`
	ETLSinks        []ETLSink         `json:"sinks"`
}

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"`
}

This module is only used in SLS Trigger for Aliyun FunctionCompute.

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 ETLSchedule added in v0.1.16

type ETLSchedule struct {
	Type string `json:"type"`
}

type ETLSink added in v0.1.16

type ETLSink struct {
	AccessKeyId     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`
	Endpoint        string `json:"endpoint"`
	Logstore        string `json:"logstore"`
	Name            string `json:"name"`
	Project         string `json:"project"`
	RoleArn         string `json:"roleArn,omitempty"`
	Type            string `json:"type,omitempty"`
}

type EncryptConf added in v0.1.21

type EncryptConf struct {
	Enable      bool                `json:"enable"`
	EncryptType string              `json:"encrypt_type"`
	UserCmkInfo *EncryptUserCmkConf `json:"user_cmk_info,omitempty"`
}

encrypt struct

type EncryptUserCmkConf added in v0.1.21

type EncryptUserCmkConf struct {
	CmkKeyId string `json:"cmk_key_id"`
	Arn      string `json:"arn"`
	RegionId string `json:"region_id"`
}

EncryptUserCmkConf struct

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 Export added in v0.1.30

type Export struct {
	ScheduledJob
	ExportConfiguration *ExportConfiguration `json:"configuration"`
}

type ExportConfiguration added in v0.1.30

type ExportConfiguration struct {
	FromTime   int64             `json:"fromTime"`
	ToTime     int64             `json:"toTime"`
	LogStore   string            `json:"logstore"`
	Parameters map[string]string `json:"parameters"`
	RoleArn    string            `json:"roleArn"`
	Version    ExportVersion     `json:"version"`
	DataSink   DataSink          `json:"sink"`
}

func (*ExportConfiguration) UnmarshalJSON added in v0.1.30

func (e *ExportConfiguration) UnmarshalJSON(data []byte) error

type ExportVersion added in v0.1.30

type ExportVersion string

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"`
	RoleARN          string `json:"roleArn"`
}

type GetContextLogsResponse added in v0.1.6

type GetContextLogsResponse struct {
	Progress     string              `json:"progress"`
	TotalLines   int64               `json:"total_lines"`
	BackLines    int64               `json:"back_lines"`
	ForwardLines int64               `json:"forward_lines"`
	Logs         []map[string]string `json:"logs"`
}

func (*GetContextLogsResponse) IsComplete added in v0.1.6

func (resp *GetContextLogsResponse) IsComplete() bool

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 GetLogLinesResponse added in v0.1.17

type GetLogLinesResponse struct {
	GetLogsResponse
	Lines []json.RawMessage
}

GetLogLinesResponse defines response from GetLogLines call note: GetLogLinesResponse.Logs is nil when use GetLogLinesResponse

type GetLogRequest added in v0.1.24

type GetLogRequest struct {
	From     int64  `json:"from"`  // unix time, eg time.Now().Unix() - 900
	To       int64  `json:"to"`    // unix time, eg time.Now().Unix()
	Topic    string `json:"topic"` // @note topic is not used anymore, use __topic__ : xxx in query instead
	Lines    int64  `json:"lines"` // max 100; offset, lines and reverse is ignored when use SQL in query
	Offset   int64  `json:"offset"`
	Reverse  bool   `json:"reverse"`
	Query    string `json:"query"`
	PowerSQL bool   `json:"powerSql"`
}

GetLogRequest for GetLogsV2

func (*GetLogRequest) ToURLParams added in v0.1.24

func (glr *GetLogRequest) ToURLParams() url.Values

type GetLogsResponse

type GetLogsResponse struct {
	Progress string              `json:"progress"`
	Count    int64               `json:"count"`
	Logs     []map[string]string `json:"logs"`
	Contents string              `json:"contents"`
	HasSQL   bool                `json:"hasSQL"`
	Header   http.Header         `json:"header"`
}

GetLogsResponse defines response from GetLogs call

func (*GetLogsResponse) GetKeys added in v0.1.5

func (resp *GetLogsResponse) GetKeys() (error, []string)

func (*GetLogsResponse) IsComplete

func (resp *GetLogsResponse) IsComplete() bool

type GetLogsV3Response added in v0.1.45

type GetLogsV3Response struct {
	Meta GetLogsV3ResponseMeta `json:"meta"`
	Logs []map[string]string   `json:"data"`
}

GetLogsV3Response defines response from GetLogs call

type GetLogsV3ResponseMeta added in v0.1.45

type GetLogsV3ResponseMeta struct {
	Progress           string  `json:"progress"`
	AggQuery           string  `json:"aggQuery"`
	WhereQuery         string  `json:"whereQuery"`
	HasSQL             bool    `json:"hasSQL"`
	ProcessedRows      int64   `json:"processedRows"`
	ElapsedMillisecond int64   `json:"elapsedMillisecond"`
	CpuSec             float64 `json:"cpuSec"`
	CpuCores           float64 `json:"cpuCores"`
	Limited            int64   `json:"limited"`
	Count              int64   `json:"count"`
}

type GlobalConfig added in v0.1.22

type GlobalConfig struct {
	ConfigId     string `json:"config_id"`
	ConfigName   string `json:"config_name"`
	ConfigDetail struct {
		AlertCenterLog struct {
			Region string `json:"region"`
		} `json:"alert_center_log"`
	} `json:"config_detail"`
}

GlobalConfig is the global configuration for alerts.

type GroupConfiguration added in v0.1.22

type GroupConfiguration struct {
	Type   string   `json:"type"`
	Fields []string `json:"fields"`
}

type Index

type Index struct {
	Keys                   map[string]IndexKey `json:"keys,omitempty"`
	Line                   *IndexLine          `json:"line,omitempty"`
	Ttl                    uint32              `json:"ttl,omitempty"`
	MaxTextLen             uint32              `json:"max_text_len,omitempty"`
	LogReduce              bool                `json:"log_reduce"`
	LogReduceWhiteListDict []string            `json:"log_reduce_white_list,omitempty"`
	LogReduceBlackListDict []string            `json:"log_reduce_black_list,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
	JsonKeys      map[string]*JsonKey `json:"json_keys,omitempty"`
}

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 Ingestion added in v0.1.28

type Ingestion struct {
	ScheduledJob
	IngestionConfiguration *IngestionConfiguration `json:"configuration"`
}

type IngestionConfiguration added in v0.1.28

type IngestionConfiguration struct {
	Version          string      `json:"version"`
	LogStore         string      `json:"logstore"`
	NumberOfInstance int32       `json:"numberOfInstance"`
	DataSource       interface{} `json:"source"`
}

type IngestionGeneralSource added in v0.1.28

type IngestionGeneralSource struct {
	DataSource
	Fields map[string]interface{}
}

ingestion general source

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 InstanceStatus added in v0.1.22

type InstanceStatus struct {
	FromTime int64
	ToTime   int64
	Offset   int64
	Size     int64
	State    ScheduledSQLState
}

type JSONConfigInputDetail

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

JSONConfigInputDetail pure json log config

func ConvertToJSONConfigInputDetail

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

type JSONFormat added in v0.1.28

type JSONFormat struct {
	StructureDataFormat
	SkipInvalidRows bool `json:"skipInvalidRows"`
}

type JobLogConfig

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

type JobType added in v0.1.22

type JobType string
const (
	ALERT_JOB         JobType = "Alert"
	REPORT_JOB        JobType = "Report"
	ETL_JOB           JobType = "ETL"
	INGESTION_JOB     JobType = "Ingestion"
	REBUILD_INDEX_JOB JobType = "RebuildIndex"
	AUDIT_JOB_JOB     JobType = "AuditJob"
	EXPORT_JOB        JobType = "Export"
	SCHEDULED_SQL_JOB JobType = "ScheduledSQL"
)

type JoinConfiguration added in v0.1.22

type JoinConfiguration struct {
	Type      string `json:"type"`
	Condition string `json:"condition"`
}

type JsonContentDetail added in v0.1.30

type JsonContentDetail struct {
	EnableTag bool `json:"enableTag"`
}

type JsonKey added in v0.1.6

type JsonKey struct {
	Type     string `json:"type"`
	Alias    string `json:"alias,omitempty"`
	DocValue bool   `json:"doc_value,omitempty"`
}

type KafkaPosition added in v0.1.28

type KafkaPosition string

type KafkaSource added in v0.1.28

type KafkaSource struct {
	DataSource
	Topics           string            `json:"topics"`
	BootStrapServers string            `json:"bootstrapServers"`
	ValueType        KafkaValueType    `json:"valueType"`
	FromPosition     KafkaPosition     `json:"fromPosition"`
	FromTimeStamp    int64             `json:"fromTimestamp"`
	ToTimeStamp      int64             `json:"toTimestamp"`
	TimeField        string            `json:"timeField"`
	TimePattern      string            `json:"timePattern"`
	TimeFormat       string            `json:"timeFormat"`
	TimeZone         string            `json:"timeZone"`
	AdditionalProps  map[string]string `json:"additionalProps"`
}

type KafkaValueType added in v0.1.28

type KafkaValueType string

ingestion kafka source

type LineFormat added in v0.1.28

type LineFormat struct {
	OSSDataFormat
	TimePattern string `json:"timePattern"`
}

type ListETLResponse added in v0.1.16

type ListETLResponse struct {
	Total   int    `json:"total"`
	Count   int    `json:"count"`
	Results []*ETL `json:"results"`
}

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"`
	PluginDetail       map[string]interface{} `json:"plugin,omitempty"`
	Advanced           map[string]interface{} `json:"advanced,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
	AuthVersion     AuthVersionType
	// 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) CreateLogging added in v0.1.7

func (p *LogProject) CreateLogging(detail *Logging) (err error)

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) DeleteLogging added in v0.1.7

func (p *LogProject) DeleteLogging() (err error)

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) GetLogging added in v0.1.7

func (p *LogProject) GetLogging() (c *Logging, err error)

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) ListLogStoreV2 added in v0.1.9

func (p *LogProject) ListLogStoreV2(offset, size int, telemetryType string) ([]string, error)

ListLogStoreV2 ...

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) RawRequest added in v0.1.6

func (p *LogProject) RawRequest(method, uri string, headers map[string]string, body []byte) (*http.Response, error)

RawRequest send raw http request to LogService and return the raw http response @note you should call http.Response.Body.Close() to close body stream

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) UpdateLogging added in v0.1.7

func (p *LogProject) UpdateLogging(detail *Logging) (err error)

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"`
	TelemetryType string `json:"telemetryType"`
	HotTTL        int32  `json:"hot_ttl,omitempty"`
	Mode          string `json:"mode,omitempty"` // "query" or "standard"(default), can't be modified after creation

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

	EncryptConf *EncryptConf `json:"encrypt_conf,omitempty"`
	ProductType string       `json:"productType,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) GetContextLogs added in v0.1.6

func (s *LogStore) GetContextLogs(backLines int32, forwardLines int32,
	packID string, packMeta string) (*GetContextLogsResponse, error)

GetContextLogs ...

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) GetHistogramsToCompleted added in v0.1.41

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

GetHistogramsToCompleted query logs with [from, to) time range to completed

func (*LogStore) GetIndex

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

GetIndex ...

func (*LogStore) GetIndexString

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

GetIndexString ...

func (*LogStore) GetLogLines added in v0.1.17

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

GetLogLines query logs with [from, to) time range

func (*LogStore) GetLogLinesV2 added in v0.1.24

func (s *LogStore) GetLogLinesV2(req *GetLogRequest) (*GetLogLinesResponse, error)

GetLogLinesV2 query logs with [from, to) time range

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) GetLogsToCompleted added in v0.1.41

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

GetLogsToCompleted query logs with [from, to) time range to completed

func (*LogStore) GetLogsToCompletedV2 added in v0.1.41

func (s *LogStore) GetLogsToCompletedV2(req *GetLogRequest) (*GetLogsResponse, error)

GetLogsToCompletedV2 query logs with [from, to) time range to completed

func (*LogStore) GetLogsV2 added in v0.1.24

func (s *LogStore) GetLogsV2(req *GetLogRequest) (*GetLogsResponse, error)

GetLogsV2 query logs with [from, to) time range

func (*LogStore) GetLogsV3 added in v0.1.45

func (s *LogStore) GetLogsV3(req *GetLogRequest) (*GetLogsV3Response, error)

GetLogsV3 query logs with [from, to) time range

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) ListShipper added in v0.1.14

func (s *LogStore) ListShipper() ([]string, error)

ListShipper ...

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 Logging added in v0.1.7

type Logging struct {
	Project        string           `json:"loggingProject"`
	LoggingDetails []*LoggingDetail `json:"loggingDetails"`
}

type LoggingDetail added in v0.1.7

type LoggingDetail struct {
	Type     string `json:"type"`
	Logstore string `json:"logstore"`
}

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"`
	LastHeartBeatTime int    `json:"lastHeartbeatTime"`
}

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 MetricAggRuleItem added in v0.1.19

type MetricAggRuleItem struct {
	Name        string
	QueryType   string
	Query       string
	TimeName    string
	MetricNames []string
	LabelNames  map[string]string

	BeginUnixTime int64
	EndUnixTime   int64
	Interval      int64
	DelaySeconds  int64
}

type MetricAggRules added in v0.1.19

type MetricAggRules struct {
	ID   string
	Name string
	Desc string

	SrcStore           string
	SrcAccessKeyID     string // ETL_STS_DEFAULT
	SrcAccessKeySecret string // acs:ram::${aliuid}:role/aliyunlogetlrole

	DestEndpoint        string // same region, inner endpoint; different region, public endpoint
	DestProject         string
	DestStore           string
	DestAccessKeyID     string // ETL_STS_DEFAULT
	DestAccessKeySecret string // acs:ram::${aliuid}:role/aliyunlogetlrole

	AggRules []MetricAggRuleItem
}

type MultiLineFormat added in v0.1.28

type MultiLineFormat struct {
	LineFormat
	MaxLines     int64  `json:"maxLines,omitempty"`
	Negate       bool   `json:"negate"`
	Match        string `json:"match"`
	Pattern      string `json:"pattern"`
	FlushPattern string `json:"flushPattern"`
}

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"`
	Headers    map[string]string `json:"headers,omitempty"`
}

type OSSCompressionType added in v0.1.30

type OSSCompressionType string

type OSSContentType added in v0.1.30

type OSSContentType string

type OSSDataFormat added in v0.1.28

type OSSDataFormat struct {
	Type       OSSDataFormatType `json:"type"`
	TimeFormat string            `json:"timeFormat"`
	TimeZone   string            `json:"timeZone"`
}

type OSSDataFormatType added in v0.1.28

type OSSDataFormatType string

>>> ingestion oss source

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"`
	Storage        ShipperStorage `json:"storage"`
}

type OrcContentDetail added in v0.1.30

type OrcContentDetail ColumnStorageContentDetail

type OssStorageJsonDetail added in v0.1.14

type OssStorageJsonDetail struct {
	EnableTag bool `json:"enableTag"`
}

type OssStoreageCsvDetail added in v0.1.20

type OssStoreageCsvDetail struct {
	Delimiter      string   `json:"delemiter"`
	Header         bool     `json:"header"`
	LineFeed       string   `json:"lineFeed"`
	Columns        []string `json:"columns"`
	NullIdentifier string   `json:"nullIdentfifier"`
	Quote          string   `json:"quote"`
}

type OssStoreageParquet added in v0.1.20

type OssStoreageParquet struct {
	Columns []ParquetConfig `json:"columns"`
}

type OutputDetail

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

OutputDetail defines output

type ParquetConfig added in v0.1.20

type ParquetConfig struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type ParquetContentDetail added in v0.1.30

type ParquetContentDetail ColumnStorageContentDetail

type ParquetFormat added in v0.1.28

type ParquetFormat struct {
	StructureDataFormat
}

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 PolicyConfiguration added in v0.1.22

type PolicyConfiguration struct {
	UseDefault     bool   `json:"useDefault"`
	RepeatInterval string `json:"repeatInterval"`
	AlertPolicyId  string `json:"alertPolicyId"`
	ActionPolicyId string `json:"actionPolicyId"`
}

type PowerSqlMode added in v0.1.30

type PowerSqlMode string

power sql

const (
	PowerSqlModeAuto    PowerSqlMode = "auto"
	PowerSqlModeEnable  PowerSqlMode = "enable"
	PowerSqlModeDisable PowerSqlMode = "disable"
)

type RegexConfigInputDetail

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

RegexConfigInputDetail regex log config

func ConvertToRegexConfigInputDetail

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

type Resource added in v0.1.22

type Resource struct {
	Name           string `json:"name"`
	Type           string `json:"type"`
	Schema         string `json:"schema"`
	Description    string `json:"description"`
	ExtInfo        string `json:"extInfo"`
	CreateTime     int64  `json:"createTime"`
	LastModifyTime int64  `json:"lastModifyTime"`
}

type ResourceActionPolicy added in v0.1.22

type ResourceActionPolicy struct {
	ActionPolicyId              string            `json:"action_policy_id"`
	ActionPolicyName            string            `json:"action_policy_name"`
	IsDefault                   bool              `json:"is_default"`
	PrimaryPolicyScript         string            `json:"primary_policy_script"`
	SecondaryPolicyScript       string            `json:"secondary_policy_script"`
	EscalationStartEnabled      bool              `json:"escalation_start_enabled"`
	EscalationStartTimeout      string            `json:"escalation_start_timeout"`
	EscalationInprogressEnabled bool              `json:"escalation_inprogress_enabled"`
	EscalationInprogressTimeout string            `json:"escalation_inprogress_timeout"`
	EscalationEnabled           bool              `json:"escalation_enabled"`
	EscalationTimeout           string            `json:"escalation_timeout"`
	Labels                      map[string]string `json:"labels"`
}

ResourceActionPolicy defines how to send alert notifications.

type ResourceAlertPolicy added in v0.1.22

type ResourceAlertPolicy struct {
	PolicyId      string `json:"policy_id"`
	PolicyName    string `json:"policy_name"`
	Parent        string `json:"parent_id"`
	IsDefault     bool   `json:"is_default"`
	GroupPolicy   string `json:"group_script"`
	InhibitPolicy string `json:"inhibit_script"`
	SilencePolicy string `json:"silence_script"`
}

ResourceAlertPolicy defines how alerts should be grouped, inhibited and silenced.

type ResourceContentTemplate added in v0.1.22

type ResourceContentTemplate struct {
	TemplateId   string            `json:"template_id"`
	TemplateName string            `json:"template_name"`
	IsDefault    bool              `json:"is_default"`
	Templates    ResourceTemplates `json:"templates"`
}

type ResourceFilterTag added in v0.1.13

type ResourceFilterTag struct {
	Key   *string `json:"key"`
	Value *string `json:"value"`
}

ResourceFilterTag define

type ResourcePool added in v0.1.22

type ResourcePool string
const (
	DEFAULT  ResourcePool = "default"
	ENHANCED ResourcePool = "enhanced"
)

type ResourceRecord added in v0.1.22

type ResourceRecord struct {
	Id             string `json:"id"`
	Tag            string `json:"tag"`
	Value          string `json:"value"`
	CreateTime     int64  `json:"createTime"`
	LastModifyTime int64  `json:"lastModifyTime"`
}

type ResourceSchema added in v0.1.22

type ResourceSchema struct {
	Schema []*ResourceSchemaItem `json:"schema"`
}

func (*ResourceSchema) FromJsonString added in v0.1.22

func (rs *ResourceSchema) FromJsonString(schema string) error

func (*ResourceSchema) ToString added in v0.1.22

func (rs *ResourceSchema) ToString() string

type ResourceSchemaItem added in v0.1.22

type ResourceSchemaItem struct {
	Column   string      `json:"column"`
	Desc     string      `json:"desc"`
	ExtInfo  interface{} `json:"ext_info"`
	Required bool        `json:"required"`
	Type     string      `json:"type"`
}

type ResourceTag added in v0.1.13

type ResourceTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

ResourceTag define

type ResourceTagResponse added in v0.1.13

type ResourceTagResponse struct {
	ResourceType string `json:"resourceType"`
	ResourceID   string `json:"resourceId"`
	TagKey       string `json:"tagKey"`
	TagValue     string `json:"tagValue"`
}

ResourceTagResponse used for ListTagResources

type ResourceTags added in v0.1.13

type ResourceTags struct {
	ResourceType string        `json:"resourceType"`
	ResourceID   []string      `json:"resourceId"`
	Tags         []ResourceTag `json:"tags"`
}

ResourceTags tag for tag sls resource, only support project

func NewProjectTags added in v0.1.13

func NewProjectTags(project string, tags []ResourceTag) *ResourceTags

NewProjectTags create a project tags

func NewResourceTags added in v0.1.46

func NewResourceTags(resourceType string, resourceId string, tags []ResourceTag) *ResourceTags

NewResourceTags create tags for resource of certain type

type ResourceTemplate added in v0.1.22

type ResourceTemplate struct {
	Content  string `json:"content"`
	Locale   string `json:"locale"`
	Title    string `json:"title"`
	Subject  string `json:"subject"`
	SendType string `json:"send_type"`
	Limit    int    `json:"limit"`
}

ContentTemplate

type ResourceTemplates added in v0.1.22

type ResourceTemplates struct {
	Sms           ResourceTemplate `json:"sms"`
	Voice         ResourceTemplate `json:"voice"`
	Email         ResourceTemplate `json:"email"`
	Dingtalk      ResourceTemplate `json:"dingtalk"`
	Webhook       ResourceTemplate `json:"webhook"`
	MessageCenter ResourceTemplate `json:"message_center"`
	Wechat        ResourceTemplate `json:"wechat"`
	Lark          ResourceTemplate `json:"lark"`
	Slack         ResourceTemplate `json:"slack"`
}

type ResourceUnTags added in v0.1.13

type ResourceUnTags struct {
	ResourceType string   `json:"resourceType"`
	ResourceID   []string `json:"resourceId"`
	Tags         []string `json:"tags"`
}

ResourceUnTags tag for untag sls resouce

func NewProjectUnTags added in v0.1.13

func NewProjectUnTags(project string, tags []string) *ResourceUnTags

NewProjectUnTags delete a project tags

func NewResourceUnTags added in v0.1.46

func NewResourceUnTags(resourceType string, resourceId string, tags []string) *ResourceUnTags

NewResourceUnTags delete tags for resource of certain type

type ResourceUser added in v0.1.22

type ResourceUser struct {
	UserId       string   `json:"user_id"`
	UserName     string   `json:"user_name"`
	Enabled      bool     `json:"enabled"`
	CountryCode  string   `json:"country_code"`
	Phone        string   `json:"phone"`
	Email        []string `json:"email"`
	SmsEnabled   bool     `json:"sms_enabled"`
	VoiceEnabled bool     `json:"voice_enabled"`
}

Notified users.

type ResourceUserGroup added in v0.1.22

type ResourceUserGroup struct {
	Id      string   `json:"user_group_id"`
	Name    string   `json:"user_group_name"`
	Enabled bool     `json:"enabled"`
	Members []string `json:"members"`
}

ResourceUserGroup is a collection of users.

type ResourceWebhookHeader added in v0.1.22

type ResourceWebhookHeader struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

WebhookIntegration is a wrap of webhook notification config.

type ResponseDashboardItem added in v0.1.14

type ResponseDashboardItem struct {
	DashboardName string `json:"dashboardName"`
	DisplayName   string `json:"displayName"`
}

type ResponseSavedSearchItem added in v0.1.14

type ResponseSavedSearchItem struct {
	SavedSearchName string `json:"savedsearchName"`
	DisplayName     string `json:"displayName"`
}

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"`
	CronExpression string `json:"cronExpression"`
	Delay          int32  `json:"delay"`
	DayOfWeek      int32  `json:"dayOfWeek"`
	Hour           int32  `json:"hour"`
	RunImmediately bool   `json:"runImmediately"`
	TimeZone       string `json:"timeZone,omitempty"`
}

type ScheduledJob added in v0.1.28

type ScheduledJob struct {
	BaseJob
	Status     string    `json:"status"`
	Schedule   *Schedule `json:"schedule"`
	ScheduleId string    `json:"scheduleId"`
}

type ScheduledSQL added in v0.1.22

type ScheduledSQL struct {
	Name             string                     `json:"name"`
	DisplayName      string                     `json:"displayName"`
	Description      string                     `json:"description"`
	Status           Status                     `json:"status"`
	ScheduleId       string                     `json:"scheduleId"`
	Configuration    *ScheduledSQLConfiguration `json:"configuration"`
	Schedule         *Schedule                  `json:"schedule"`
	CreateTime       int64                      `json:"createTime,omitempty"`
	LastModifiedTime int64                      `json:"lastModifiedTime,omitempty"`
	Type             JobType                    `json:"type"`
}

type ScheduledSQLConfiguration added in v0.1.22

type ScheduledSQLConfiguration struct {
	SourceLogStore      string                  `json:"sourceLogstore"`
	DestProject         string                  `json:"destProject"`
	DestEndpoint        string                  `json:"destEndpoint"`
	DestLogStore        string                  `json:"destLogstore"`
	Script              string                  `json:"script"`
	SqlType             SqlType                 `json:"sqlType"`
	ResourcePool        ResourcePool            `json:"resourcePool"`
	RoleArn             string                  `json:"roleArn"`
	DestRoleArn         string                  `json:"destRoleArn"`
	FromTimeExpr        string                  `json:"fromTimeExpr"`
	ToTimeExpr          string                  `json:"toTimeExpr"`
	MaxRunTimeInSeconds int32                   `json:"maxRunTimeInSeconds"`
	MaxRetries          int32                   `json:"maxRetries"`
	FromTime            int64                   `json:"fromTime"`
	ToTime              int64                   `json:"toTime"`
	DataFormat          DataFormat              `json:"dataFormat"`
	Parameters          *ScheduledSQLParameters `json:"parameters,omitempty"`
}

func NewScheduledSQLConfiguration added in v0.1.22

func NewScheduledSQLConfiguration() *ScheduledSQLConfiguration

type ScheduledSQLJobInstance added in v0.1.22

type ScheduledSQLJobInstance struct {
	InstanceId           string            `json:"instanceId"`
	JobName              string            `json:"jobName,omitempty"`
	DisplayName          string            `json:"displayName,omitempty"`
	Description          string            `json:"description,omitempty"`
	JobScheduleId        string            `json:"jobScheduleId,omitempty"`
	CreateTimeInMillis   int64             `json:"createTimeInMillis"`
	ScheduleTimeInMillis int64             `json:"scheduleTimeInMillis"`
	UpdateTimeInMillis   int64             `json:"updateTimeInMillis"`
	State                ScheduledSQLState `json:"state"`
	ErrorCode            string            `json:"errorCode"`
	ErrorMessage         string            `json:"errorMessage"`
	Summary              string            `json:"summary,omitempty"`
}

type ScheduledSQLParameters added in v0.1.22

type ScheduledSQLParameters struct {
	TimeKey    string `json:"timeKey,omitempty"`
	LabelKeys  string `json:"labelKeys,omitempty"`
	MetricKeys string `json:"metricKeys,omitempty"`
	MetricName string `json:"metricName,omitempty"`
	HashLabels string `json:"hashLabels,omitempty"`
	AddLabels  string `json:"addLabels,omitempty"`
}

type ScheduledSQLState added in v0.1.22

type ScheduledSQLState string
const (
	ScheduledSQL_RUNNING   ScheduledSQLState = "RUNNING"
	ScheduledSQL_FAILED    ScheduledSQLState = "FAILED"
	ScheduledSQL_SUCCEEDED ScheduledSQLState = "SUCCEEDED"
)

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 Severity added in v0.1.22

type Severity int
const (
	Report   Severity = 2
	Low      Severity = 4
	Medium   Severity = 6
	High     Severity = 8
	Critical Severity = 10
)

type SeverityConfiguration added in v0.1.22

type SeverityConfiguration struct {
	Severity      Severity               `json:"severity"`
	EvalCondition ConditionConfiguration `json:"evalCondition"`
}

SeverityConfiguration severity config by group

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 ShipperStorage added in v0.1.14

type ShipperStorage struct {
	Format string      `json:"format"`
	Detail interface{} `json:"detail"`
}

type Signer added in v0.1.42

type Signer interface {
	// Sign modifies @param headers only, adds signature and other http headers
	// that log services authorization requires.
	Sign(method, uriWithQuery string, headers map[string]string, body []byte) error
}

type SignerV1 added in v0.1.42

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

SignerV1 version v1

func NewSignerV1 added in v0.1.42

func NewSignerV1(accessKeyID, accessKeySecret string) *SignerV1

func (*SignerV1) Sign added in v0.1.42

func (s *SignerV1) Sign(method, uri string, headers map[string]string, body []byte) error

type SignerV4 added in v0.1.42

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

SignerV4 sign version v4, a non-empty region is required

func NewSignerV4 added in v0.1.42

func NewSignerV4(accessKeyID, accessKeySecret, region string) *SignerV4

func (*SignerV4) Sign added in v0.1.42

func (s *SignerV4) Sign(method, uri string, headers map[string]string, body []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 SqlType added in v0.1.22

type SqlType string
const (
	STANDARD     SqlType = "standard"
	SEARCH_QUERY SqlType = "searchQuery"
)

type Status added in v0.1.22

type Status string
const (
	ENABLED  Status = "Enabled"
	DISABLED Status = "Disabled"
)

type StreamLogConfigInputDetail

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

StreamLogConfigInputDetail syslog config

func ConvertToStreamLogConfigInputDetail

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

type StructureDataFormat added in v0.1.28

type StructureDataFormat struct {
	OSSDataFormat
	TimeField string `json:"timeField"`
}

type SubStore added in v0.1.9

type SubStore struct {
	Name           string        `json:"name,omitempty"`
	TTL            int           `json:"ttl"`
	SortedKeyCount int           `json:"sortedKeyCount"`
	TimeIndex      int           `json:"timeIndex"`
	Keys           []SubStoreKey `json:"keys"`
}

SubStore define

func NewSubStore added in v0.1.9

func NewSubStore(name string,
	ttl int,
	sortedKeyCount int,
	timeIndex int,
	keys []SubStoreKey) *SubStore

NewSubStore create a new sorted sub store

func (*SubStore) IsValid added in v0.1.9

func (s *SubStore) IsValid() bool

IsValid ...

type SubStoreKey added in v0.1.9

type SubStoreKey struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

SubStoreKey key define

func (*SubStoreKey) IsValid added in v0.1.9

func (s *SubStoreKey) IsValid() bool

IsValid ...

type Tag added in v0.1.22

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type TemplateConfiguration added in v0.1.22

type TemplateConfiguration struct {
	Id          string            `json:"id"`
	Type        string            `json:"type"`
	Version     string            `json:"version"`
	Lang        string            `json:"lang"`
	Tokens      map[string]string `json:"tokens"`
	Annotations map[string]string `json:"annotations"`
}

type Token added in v0.1.22

type Token struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Required    bool   `json:"required"`
	Type        string `json:"type"`
	Default     string `json:"default"`
	Hide        bool   `json:"hide"`
}

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) CreateAlertString added in v0.1.19

func (c *TokenAutoUpdateClient) CreateAlertString(project string, alert string) (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) CreateConsumerGroup added in v0.1.13

func (c *TokenAutoUpdateClient) CreateConsumerGroup(project, logstore string, cg ConsumerGroup) (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) CreateETL added in v0.1.39

func (c *TokenAutoUpdateClient) CreateETL(project string, etljob ETL) (err error)

func (*TokenAutoUpdateClient) CreateEtlMeta

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

func (*TokenAutoUpdateClient) CreateExport added in v0.1.30

func (c *TokenAutoUpdateClient) CreateExport(project string, export *Export) (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) CreateIngestion added in v0.1.28

func (c *TokenAutoUpdateClient) CreateIngestion(project string, ingestion *Ingestion) (err error)

####################### Ingestion API ######################

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) CreateMetricStore added in v0.1.37

func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore *LogStore) (err error)

func (*TokenAutoUpdateClient) CreateProject

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

func (*TokenAutoUpdateClient) CreateResource added in v0.1.22

func (c *TokenAutoUpdateClient) CreateResource(resource *Resource) (err error)

func (*TokenAutoUpdateClient) CreateResourceRecord added in v0.1.22

func (c *TokenAutoUpdateClient) CreateResourceRecord(resourceName string, record *ResourceRecord) (err error)

func (*TokenAutoUpdateClient) CreateResourceRecordString added in v0.1.22

func (c *TokenAutoUpdateClient) CreateResourceRecordString(resourceName, recordStr string) (err error)

func (*TokenAutoUpdateClient) CreateResourceString added in v0.1.22

func (c *TokenAutoUpdateClient) CreateResourceString(resourceStr string) (err error)

func (*TokenAutoUpdateClient) CreateSavedSearch

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

func (*TokenAutoUpdateClient) CreateScheduledSQL added in v0.1.22

func (c *TokenAutoUpdateClient) CreateScheduledSQL(project string, scheduledsql *ScheduledSQL) (err error)

####################### Scheduled SQL API ######################

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) DeleteConsumerGroup added in v0.1.13

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

func (*TokenAutoUpdateClient) DeleteDashboard

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

func (*TokenAutoUpdateClient) DeleteETL added in v0.1.39

func (c *TokenAutoUpdateClient) DeleteETL(project string, etlName string) (err error)

func (*TokenAutoUpdateClient) DeleteEtlMeta

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

func (*TokenAutoUpdateClient) DeleteExport added in v0.1.30

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

func (*TokenAutoUpdateClient) DeleteIndex

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

func (*TokenAutoUpdateClient) DeleteIngestion added in v0.1.28

func (c *TokenAutoUpdateClient) DeleteIngestion(project string, name 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) DeleteMetricStore added in v0.1.37

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

func (*TokenAutoUpdateClient) DeleteProject

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

func (*TokenAutoUpdateClient) DeleteProjectPolicy added in v0.1.39

func (c *TokenAutoUpdateClient) DeleteProjectPolicy(project string) (err error)

func (*TokenAutoUpdateClient) DeleteResource added in v0.1.22

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

func (*TokenAutoUpdateClient) DeleteResourceRecord added in v0.1.22

func (c *TokenAutoUpdateClient) DeleteResourceRecord(resourceName, recordId string) (err error)

func (*TokenAutoUpdateClient) DeleteSavedSearch

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

func (*TokenAutoUpdateClient) DeleteScheduledSQL added in v0.1.22

func (c *TokenAutoUpdateClient) DeleteScheduledSQL(project string, name 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) GetAlertString added in v0.1.19

func (c *TokenAutoUpdateClient) GetAlertString(project string, alertName string) (alert string, 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) GetCheckpoint added in v0.1.13

func (c *TokenAutoUpdateClient) GetCheckpoint(project, logstore string, cgName string) (checkPointList []*ConsumerGroupCheckPoint, 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) GetCursorTime added in v0.1.18

func (c *TokenAutoUpdateClient) GetCursorTime(project, logstore string, shardID int, cursor string) (cursorTime time.Time, 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) GetETL added in v0.1.39

func (c *TokenAutoUpdateClient) GetETL(project string, etlName string) (ETLJob *ETL, err error)

func (*TokenAutoUpdateClient) GetEtlMeta

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

func (*TokenAutoUpdateClient) GetExport added in v0.1.30

func (c *TokenAutoUpdateClient) GetExport(project, name string) (export *Export, 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) GetHistogramsToCompleted added in v0.1.41

func (c *TokenAutoUpdateClient) GetHistogramsToCompleted(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) GetIngestion added in v0.1.28

func (c *TokenAutoUpdateClient) GetIngestion(project string, name string) (ingestion *Ingestion, err error)

func (*TokenAutoUpdateClient) GetLogLines added in v0.1.17

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

func (*TokenAutoUpdateClient) GetLogLinesV2 added in v0.1.24

func (c *TokenAutoUpdateClient) GetLogLinesV2(project, logstore string, req *GetLogRequest) (r *GetLogLinesResponse, 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) GetLogsToCompleted added in v0.1.41

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

func (*TokenAutoUpdateClient) GetLogsToCompletedV2 added in v0.1.41

func (c *TokenAutoUpdateClient) GetLogsToCompletedV2(project, logstore string, req *GetLogRequest) (r *GetLogsResponse, err error)

func (*TokenAutoUpdateClient) GetLogsV2 added in v0.1.24

func (c *TokenAutoUpdateClient) GetLogsV2(project, logstore string, req *GetLogRequest) (r *GetLogsResponse, err error)

func (*TokenAutoUpdateClient) GetLogsV3 added in v0.1.45

func (c *TokenAutoUpdateClient) GetLogsV3(project, logstore string, req *GetLogRequest) (r *GetLogsV3Response, err error)

func (*TokenAutoUpdateClient) GetMachineGroup

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

func (*TokenAutoUpdateClient) GetMetricStore added in v0.1.37

func (c *TokenAutoUpdateClient) GetMetricStore(project, name string) (metricStore *LogStore, err error)

func (*TokenAutoUpdateClient) GetProject

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

func (*TokenAutoUpdateClient) GetProjectPolicy added in v0.1.39

func (c *TokenAutoUpdateClient) GetProjectPolicy(project string) (policy string, err error)

func (*TokenAutoUpdateClient) GetResource added in v0.1.22

func (c *TokenAutoUpdateClient) GetResource(name string) (resource *Resource, err error)

func (*TokenAutoUpdateClient) GetResourceRecord added in v0.1.22

func (c *TokenAutoUpdateClient) GetResourceRecord(resourceName, recordId string) (record *ResourceRecord, err error)

func (*TokenAutoUpdateClient) GetResourceRecordString added in v0.1.22

func (c *TokenAutoUpdateClient) GetResourceRecordString(resourceName, name string) (record string, err error)

func (*TokenAutoUpdateClient) GetResourceString added in v0.1.22

func (c *TokenAutoUpdateClient) GetResourceString(name string) (resource string, err error)

func (*TokenAutoUpdateClient) GetSavedSearch

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

func (*TokenAutoUpdateClient) GetScheduledSQL added in v0.1.22

func (c *TokenAutoUpdateClient) GetScheduledSQL(project string, name string) (s *ScheduledSQL, err error)

func (*TokenAutoUpdateClient) GetScheduledSQLJobInstance added in v0.1.22

func (c *TokenAutoUpdateClient) GetScheduledSQLJobInstance(projectName, jobName, instanceId string, result bool) (instance *ScheduledSQLJobInstance, err error)

func (*TokenAutoUpdateClient) HeartBeat added in v0.1.13

func (c *TokenAutoUpdateClient) HeartBeat(project, logstore string, cgName, consumer string, heartBeatShardIDs []int) (shardIDs []int, 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) ListConsumerGroup added in v0.1.13

func (c *TokenAutoUpdateClient) ListConsumerGroup(project, logstore string) (cgList []*ConsumerGroup, 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) ListDashboardV2 added in v0.1.14

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

func (*TokenAutoUpdateClient) ListETL added in v0.1.39

func (c *TokenAutoUpdateClient) ListETL(project string, offset int, size int) (ETLResponse *ListETLResponse, 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) ListExport added in v0.1.30

func (c *TokenAutoUpdateClient) ListExport(project, logstore, name, displayName string, offset, size int) (exports []*Export, total, count int, err error)

func (*TokenAutoUpdateClient) ListIngestion added in v0.1.28

func (c *TokenAutoUpdateClient) ListIngestion(project, logstore, name, displayName string, offset, size int) (ingestions []*Ingestion, total, count int, 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) ListResource added in v0.1.22

func (c *TokenAutoUpdateClient) ListResource(resourceType string, resourceName string, offset, size int) (resourceList []*Resource, count, total int, err error)

####################### Resource API ######################

func (*TokenAutoUpdateClient) ListResourceRecord added in v0.1.22

func (c *TokenAutoUpdateClient) ListResourceRecord(resourceName string, offset, size int) (recordList []*ResourceRecord, count, total int, err error)

####################### Resource Record API ######################

func (*TokenAutoUpdateClient) ListSavedSearch

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

func (*TokenAutoUpdateClient) ListSavedSearchV2 added in v0.1.14

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

func (*TokenAutoUpdateClient) ListScheduledSQL added in v0.1.22

func (c *TokenAutoUpdateClient) ListScheduledSQL(project, name, displayName string, offset, size int) (scheduledsqls []*ScheduledSQL, total, count int, err error)

func (*TokenAutoUpdateClient) ListScheduledSQLJobInstances added in v0.1.22

func (c *TokenAutoUpdateClient) ListScheduledSQLJobInstances(projectName, jobName string, status *InstanceStatus) (instances []*ScheduledSQLJobInstance, total, count int64, err error)

func (*TokenAutoUpdateClient) ListShards

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

func (*TokenAutoUpdateClient) ListTagResources added in v0.1.13

func (c *TokenAutoUpdateClient) ListTagResources(project string,
	resourceType string,
	resourceIDs []string,
	tags []ResourceFilterTag,
	nextToken string) (respTags []*ResourceTagResponse, respNextToken string, err error)

ListTagResources list rag resources

func (*TokenAutoUpdateClient) MergeShards

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

func (*TokenAutoUpdateClient) ModifyScheduledSQLJobInstanceState added in v0.1.22

func (c *TokenAutoUpdateClient) ModifyScheduledSQLJobInstanceState(projectName, jobName, instanceId string, state ScheduledSQLState) (err error)

func (*TokenAutoUpdateClient) PostLogStoreLogs

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

func (*TokenAutoUpdateClient) PublishAlertEvent added in v0.1.43

func (c *TokenAutoUpdateClient) PublishAlertEvent(project string, alertResult []byte) 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) RestartETL added in v0.1.39

func (c *TokenAutoUpdateClient) RestartETL(project string, etljob ETL) (err error)

func (*TokenAutoUpdateClient) RestartExport added in v0.1.38

func (c *TokenAutoUpdateClient) RestartExport(project string, export *Export) (err error)

func (*TokenAutoUpdateClient) SetAuthVersion added in v0.1.42

func (c *TokenAutoUpdateClient) SetAuthVersion(version AuthVersionType)

SetAuthVersion set auth version that the client used

func (*TokenAutoUpdateClient) SetHTTPClient added in v0.1.31

func (c *TokenAutoUpdateClient) SetHTTPClient(client *http.Client)

SetHTTPClient set a custom http client, all request will send to sls by this client

func (*TokenAutoUpdateClient) SetRegion added in v0.1.42

func (c *TokenAutoUpdateClient) SetRegion(region string)

SetRegion set a region, must be set if using signature version v4

func (*TokenAutoUpdateClient) SetUserAgent added in v0.1.34

func (c *TokenAutoUpdateClient) SetUserAgent(userAgent string)

func (*TokenAutoUpdateClient) SplitNumShard added in v0.1.38

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

func (*TokenAutoUpdateClient) SplitShard

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

func (*TokenAutoUpdateClient) StartETL added in v0.1.39

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

func (*TokenAutoUpdateClient) StopETL added in v0.1.39

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

func (*TokenAutoUpdateClient) TagResources added in v0.1.13

func (c *TokenAutoUpdateClient) TagResources(project string, tags *ResourceTags) (err error)

####################### Resource Tags API ###################### TagResources tag specific resource

func (*TokenAutoUpdateClient) UnTagResources added in v0.1.13

func (c *TokenAutoUpdateClient) UnTagResources(project string, tags *ResourceUnTags) (err error)

UnTagResources untag specific resource

func (*TokenAutoUpdateClient) UpdateAlert

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

func (*TokenAutoUpdateClient) UpdateAlertString added in v0.1.19

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

func (*TokenAutoUpdateClient) UpdateChart

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

func (*TokenAutoUpdateClient) UpdateCheckpoint added in v0.1.13

func (c *TokenAutoUpdateClient) UpdateCheckpoint(project, logstore string, cgName string, consumer string, shardID int, checkpoint string, forceSuccess bool) (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) UpdateConsumerGroup added in v0.1.13

func (c *TokenAutoUpdateClient) UpdateConsumerGroup(project, logstore string, cg ConsumerGroup) (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) UpdateETL added in v0.1.39

func (c *TokenAutoUpdateClient) UpdateETL(project string, etljob ETL) (err error)

func (*TokenAutoUpdateClient) UpdateEtlMeta

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

func (*TokenAutoUpdateClient) UpdateExport added in v0.1.30

func (c *TokenAutoUpdateClient) UpdateExport(project string, export *Export) (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) UpdateIngestion added in v0.1.28

func (c *TokenAutoUpdateClient) UpdateIngestion(project string, ingestion *Ingestion) (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) UpdateMetricStore added in v0.1.37

func (c *TokenAutoUpdateClient) UpdateMetricStore(project string, metricStore *LogStore) (err error)

func (*TokenAutoUpdateClient) UpdateProject added in v0.1.13

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

UpdateProject create a new loghub project.

func (*TokenAutoUpdateClient) UpdateProjectPolicy added in v0.1.39

func (c *TokenAutoUpdateClient) UpdateProjectPolicy(project, policy string) (err error)

func (*TokenAutoUpdateClient) UpdateResource added in v0.1.22

func (c *TokenAutoUpdateClient) UpdateResource(resource *Resource) (err error)

func (*TokenAutoUpdateClient) UpdateResourceRecord added in v0.1.22

func (c *TokenAutoUpdateClient) UpdateResourceRecord(resourceName string, record *ResourceRecord) (err error)

func (*TokenAutoUpdateClient) UpdateResourceRecordString added in v0.1.22

func (c *TokenAutoUpdateClient) UpdateResourceRecordString(resourceName, recordStr string) (err error)

func (*TokenAutoUpdateClient) UpdateResourceString added in v0.1.22

func (c *TokenAutoUpdateClient) UpdateResourceString(resourceName, resourceStr string) (err error)

func (*TokenAutoUpdateClient) UpdateSavedSearch

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

func (*TokenAutoUpdateClient) UpdateScheduledSQL added in v0.1.22

func (c *TokenAutoUpdateClient) UpdateScheduledSQL(project string, scheduledsql *ScheduledSQL) (err error)

type TriggerConfig

type TriggerConfig struct {
	MaxRetryTime     int    `json:"maxRetryTime"`
	TriggerInterval  int    `json:"triggerInterval"`
	RoleARN          string `json:"roleArn"`
	StartingPosition string `json:"startingPosition"`
	StartingUnixtime int64  `json:"startingUnixtime"`
}

type UpdateTokenFunction

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

type WebhookIntegration added in v0.1.22

type WebhookIntegration struct {
	Id      string                   `json:"id"`
	Name    string                   `json:"name"`
	Method  string                   `json:"method"`
	Url     string                   `json:"url"`
	Type    string                   `json:"type"`
	Headers []*ResourceWebhookHeader `json:"headers"`
	Secret  string                   `json:"secret"`
}

Jump to

Keyboard shortcuts

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