cls

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

README

CLS(Cloud Log Service)

Package cls provides simple API for CLS.

Installation

To install cls package, you need to install Go and set your Go workspace first.

  1. The first need Go installed (version 1.13+ is required), then you can use the below Go command to install cls.

    go get -u github.com/mulinbc/cls
    
  2. Import it in your code:

    import "github.com/mulinbc/cls"
    

Documentation

Overview

Package cls provides simple API for CLS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlphabeticCaseInsensitive

type AlphabeticCaseInsensitive []string

AlphabeticCaseInsensitive 用于大小写不敏感的字母序排序。

func (AlphabeticCaseInsensitive) Len

func (AlphabeticCaseInsensitive) Less

func (p AlphabeticCaseInsensitive) Less(i, j int) bool

func (AlphabeticCaseInsensitive) Swap

func (p AlphabeticCaseInsensitive) Swap(i, j int)

type Client

type Client struct {
	SecretID      string        `validate:"required"`
	SecretKey     string        `validate:"required"`
	Scheme        string        `validate:"oneof=http https"`
	Host          string        `validate:"hostname"`
	SignAlgorithm string        `validate:"oneof=sha1"`
	CompressType  string        `validate:"oneof=lz4"`
	Expire        time.Duration `validate:"required"`

	Log *LogService
	// contains filtered or unexported fields
}

Client 表示与 CLS API 通信所需的数据结构。

func NewClient

func NewClient(httpClient *http.Client, secretID, secretKey, scheme, host, signAlgorithm, compressType string, expire time.Duration) (*Client, error)

NewClient 返回调用 CLS API 的客户端。

type ErrorInfo

type ErrorInfo struct {
	ErrorCode    string `json:"errorcode"`
	ErrorMessage string `json:"errormessage"`
}

ErrorInfo 表示 CLS API 返回的错误信息。

type Log

type Log struct {
	Time                 *int64         `protobuf:"varint,1,req,name=time" json:"time,omitempty"`
	Contents             []*Log_Content `protobuf:"bytes,2,rep,name=contents" json:"contents,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*Log) Descriptor

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

func (*Log) GetContents

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

func (*Log) GetTime

func (m *Log) GetTime() int64

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) Reset

func (m *Log) Reset()

func (*Log) String

func (m *Log) String() string

func (*Log) XXX_DiscardUnknown

func (m *Log) XXX_DiscardUnknown()

func (*Log) XXX_Marshal

func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Log) XXX_Merge

func (m *Log) XXX_Merge(src proto.Message)

func (*Log) XXX_Size

func (m *Log) XXX_Size() int

func (*Log) XXX_Unmarshal

func (m *Log) XXX_Unmarshal(b []byte) error

type LogGroup

type LogGroup struct {
	Logs                 []*Log   `protobuf:"bytes,1,rep,name=logs" json:"logs,omitempty"`
	ContextFlow          *string  `protobuf:"bytes,2,opt,name=contextFlow" json:"contextFlow,omitempty"`
	Filename             *string  `protobuf:"bytes,3,opt,name=filename" json:"filename,omitempty"`
	Source               *string  `protobuf:"bytes,4,opt,name=source" json:"source,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*LogGroup) Descriptor

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

func (*LogGroup) GetContextFlow

func (m *LogGroup) GetContextFlow() string

func (*LogGroup) GetFilename

func (m *LogGroup) GetFilename() string

func (*LogGroup) GetLogs

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

func (*LogGroup) GetSource

func (m *LogGroup) GetSource() string

func (*LogGroup) ProtoMessage

func (*LogGroup) ProtoMessage()

func (*LogGroup) Reset

func (m *LogGroup) Reset()

func (*LogGroup) String

func (m *LogGroup) String() string

func (*LogGroup) XXX_DiscardUnknown

func (m *LogGroup) XXX_DiscardUnknown()

func (*LogGroup) XXX_Marshal

func (m *LogGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LogGroup) XXX_Merge

func (m *LogGroup) XXX_Merge(src proto.Message)

func (*LogGroup) XXX_Size

func (m *LogGroup) XXX_Size() int

func (*LogGroup) XXX_Unmarshal

func (m *LogGroup) XXX_Unmarshal(b []byte) error

type LogGroupList

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

func (*LogGroupList) Descriptor

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

func (*LogGroupList) GetLogGroupList

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

func (*LogGroupList) ProtoMessage

func (*LogGroupList) ProtoMessage()

func (*LogGroupList) Reset

func (m *LogGroupList) Reset()

func (*LogGroupList) String

func (m *LogGroupList) String() string

func (*LogGroupList) XXX_DiscardUnknown

func (m *LogGroupList) XXX_DiscardUnknown()

func (*LogGroupList) XXX_Marshal

func (m *LogGroupList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LogGroupList) XXX_Merge

func (m *LogGroupList) XXX_Merge(src proto.Message)

func (*LogGroupList) XXX_Size

func (m *LogGroupList) XXX_Size() int

func (*LogGroupList) XXX_Unmarshal

func (m *LogGroupList) XXX_Unmarshal(b []byte) error

type LogObject

type LogObject struct {
	TopicID   string `json:"topic_id"`
	TopicName string `json:"topic_name"`
	Timestamp string `json:"timestamp"`
	Content   string `json:"content"`
	Filename  string `json:"filename"`
	Source    string `json:"source"`
}

LogObject 表示日志内容信息。

type LogService

type LogService service

LogService 表示日志管理相关 API。

func (*LogService) Search

func (p *LogService) Search(ctx context.Context, w io.Writer, logsetID string, topicIDs []string, startTime, endTime time.Time, query string, limit int, context string, desc bool) ([]string, error)

Search 用于搜索日志,最多 10000 条。

func (*LogService) Upload

func (p *LogService) Upload(topicID string, l *LogGroupList, compress, hash bool) (string, error)

Upload 用于上传结构化日志。 如果 hash 为 true,则使用哈希路由模式,以保证数据在该分区上写入和消费是严格保序的。 https://cloud.tencent.com/document/product/614/39259

type Log_Content

type Log_Content struct {
	Key                  *string  `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
	Value                *string  `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Log_Content) Descriptor

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

func (*Log_Content) GetKey

func (m *Log_Content) GetKey() string

func (*Log_Content) GetValue

func (m *Log_Content) GetValue() string

func (*Log_Content) ProtoMessage

func (*Log_Content) ProtoMessage()

func (*Log_Content) Reset

func (m *Log_Content) Reset()

func (*Log_Content) String

func (m *Log_Content) String() string

func (*Log_Content) XXX_DiscardUnknown

func (m *Log_Content) XXX_DiscardUnknown()

func (*Log_Content) XXX_Marshal

func (m *Log_Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Log_Content) XXX_Merge

func (m *Log_Content) XXX_Merge(src proto.Message)

func (*Log_Content) XXX_Size

func (m *Log_Content) XXX_Size() int

func (*Log_Content) XXX_Unmarshal

func (m *Log_Content) XXX_Unmarshal(b []byte) error

type SearchResponse

type SearchResponse struct {
	Context  string      `json:"context"`
	Listover bool        `json:"listover"`
	Results  []LogObject `json:"results"`
	SQLFlag  bool        `json:"sql_flag"`
}

SearchResponse 表示 CLS 搜索日志 API 响应信息。

Jump to

Keyboard shortcuts

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