Documentation ¶
Overview ¶
Package bklog log
Index ¶
- Constants
- func DeleteLogCollectors(ctx context.Context, ruleID int) error
- func GetBcsCollectorStorage(ctx context.Context, spaceUID, clusterID string) (int, error)
- func HasLog(ctx context.Context, indexSetID int) (bool, error)
- func MergeOutLabels(matchLabels, matchExpressions []Label) ([]Label, []Label)
- func RetryLogCollectors(ctx context.Context, ruleID int) error
- func StartLogCollectors(ctx context.Context, ruleID int) error
- func StopLogCollectors(ctx context.Context, ruleID int) error
- func SwitchStorage(ctx context.Context, spaceUID, bcsClusterID string, storageClusterID int) error
- type BaseResp
- type Conditions
- type Container
- type ContainerConfig
- type CreateBCSCollectorReq
- type CreateBCSCollectorResp
- type CreateBCSCollectorRespData
- type DataInfo
- type GetBcsCollectorStorageResp
- type GetStorageClustersResp
- type GetStorageClustersRespData
- type Label
- type LabelSelector
- type ListBCSCollectorResp
- type ListBCSCollectorRespData
- type LogRule
- type LogRuleContainer
- type Multiline
- type Params
- type QueryLogResp
- type SeparatorFilters
- type StdoutConf
- type UpdateBCSCollectoRespData
- type UpdateBCSCollectorReq
- type UpdateBCSCollectorResp
Constants ¶
const ( // SuccessStatus log rule is health SuccessStatus = "SUCCESS" // DefaultEncoding default data encoding DefaultEncoding = "UTF-8" )
Variables ¶
This section is empty.
Functions ¶
func DeleteLogCollectors ¶
DeleteLogCollectors delete log collectors
func GetBcsCollectorStorage ¶
GetBcsCollectorStorage get bcs collector storage
func MergeOutLabels ¶
MergeOutLabels merge labels matchLabels 分开非 = 的表达式到 matchExpressions
func RetryLogCollectors ¶
RetryLogCollectors retry log collectors
func StartLogCollectors ¶
StartLogCollectors start log collectors
func StopLogCollectors ¶
StopLogCollectors stop log collectors
Types ¶
type BaseResp ¶
type BaseResp struct { Code json.Number `json:"code"` Result bool `json:"result"` Message string `json:"message"` RequestID string `json:"request_id"` }
BaseResp base resp
type Conditions ¶
type Conditions struct { Type string `json:"type"` // match, separator MatchType string `json:"match_type"` // include, exclude(开发中,暂不支持) MatchContent string `json:"match_content"` Separator string `json:"separator"` // 分隔符,| 等 SeparatorFilters []SeparatorFilters `json:"separator_filters,omitempty"` // 分隔符过滤条件 }
Conditions content condition match
type Container ¶
type Container struct { WorkloadType string `json:"workload_type"` WorkloadName string `json:"workload_name"` ContainerName string `json:"container_name"` }
Container container config
type ContainerConfig ¶
type ContainerConfig struct { ID int `json:"id"` BkDataID int `json:"bk_data_id"` BKDataDataID int `json:"bkdata_data_id"` // 计算平台 dataid Namespaces []string `json:"namespaces"` AnyNamespace bool `json:"any_namespace"` DataEncoding string `json:"data_encoding"` Params Params `json:"params"` Container Container `json:"container"` LabelSelector LabelSelector `json:"label_selector"` AllContainer bool `json:"all_container"` Status string `json:"status"` Message string `json:"status_detail"` EnableStdout bool `json:"enable_stdout"` StdoutConf StdoutConf `json:"stdout_conf"` }
ContainerConfig container config
type CreateBCSCollectorReq ¶
type CreateBCSCollectorReq struct { SpaceUID string `json:"space_uid"` ProjectID string `json:"project_id"` CollectorConfigName string `json:"collector_config_name"` CollectorConfigNameEN string `json:"collector_config_name_en"` Description string `json:"description"` BCSClusterID string `json:"bcs_cluster_id"` AddPodLabel bool `json:"add_pod_label"` ExtraLabels []Label `json:"extra_labels,omitempty"` LogRuleContainer []LogRuleContainer `json:"config"` }
CreateBCSCollectorReq req
func (*CreateBCSCollectorReq) String ¶
func (req *CreateBCSCollectorReq) String() string
String get req json string
type CreateBCSCollectorResp ¶
type CreateBCSCollectorResp struct { BaseResp Data CreateBCSCollectorRespData `json:"data"` }
CreateBCSCollectorResp xxx
type CreateBCSCollectorRespData ¶
type CreateBCSCollectorRespData struct { RuleID int `json:"rule_id"` FileIndexSetID int `json:"file_index_set_id"` STDIndexSetID int `json:"std_index_set_id"` RuleFileIndexSetID int `json:"rule_file_index_set_id"` RuleSTDIndexSetID int `json:"rule_std_index_set_id"` BKDataID int `json:"bk_data_id"` StdoutConf StdoutConf `json:"stdout_conf"` }
CreateBCSCollectorRespData xxx
func CreateLogCollectors ¶
func CreateLogCollectors(ctx context.Context, req *CreateBCSCollectorReq) (*CreateBCSCollectorRespData, error)
CreateLogCollectors create log collectors
type DataInfo ¶
type DataInfo struct { FileDataID int `json:"file_data_id"` // 文件日志 dataid StdDataID int `json:"std_data_id"` // 标准输出日志 dataid FileBKDataDataID int `json:"file_bkdata_data_id"` // 计算平台文件日志 dataid StdBKDataDataID int `json:"std_bkdata_data_id"` // 计算平台标准输出日志 dataid }
DataInfo data info
type GetBcsCollectorStorageResp ¶
GetBcsCollectorStorageResp xxx
type GetStorageClustersResp ¶
type GetStorageClustersResp struct { BaseResp Data []GetStorageClustersRespData `json:"data"` }
GetStorageClustersResp xxx
type GetStorageClustersRespData ¶
type GetStorageClustersRespData struct { StorageClusterID int `json:"storage_cluster_id"` StorageClusterName string `json:"storage_cluster_name"` StorageVersion string `json:"storage_version"` StorageUsage int `json:"storage_usage"` StorageTotal float64 `json:"storage_total"` IsPlatform bool `json:"is_platform"` IsSelected bool `json:"is_selected"` Description string `json:"description"` }
GetStorageClustersRespData xxx
func GetStorageClusters ¶
func GetStorageClusters(ctx context.Context, spaceUID string) ([]GetStorageClustersRespData, error)
GetStorageClusters get storage clusters
type Label ¶
type Label struct { Key string `json:"key"` Operator string `json:"operator,omitempty"` Value string `json:"value"` }
Label label
func MergeInLabels ¶
MergeInLabels merge labels matchExpressions 合并到 matchLabels
type LabelSelector ¶
type LabelSelector struct { MatchLabels []Label `json:"match_labels,omitempty"` MatchExpressions []Label `json:"match_expressions,omitempty"` }
LabelSelector label selector
type ListBCSCollectorResp ¶
type ListBCSCollectorResp struct { BaseResp Data []ListBCSCollectorRespData `json:"data"` }
ListBCSCollectorResp xxx
type ListBCSCollectorRespData ¶
type ListBCSCollectorRespData struct { RuleID int `json:"rule_id"` CollectorConfigName string `json:"collector_config_name"` CollectorConfigNameEN string `json:"collector_config_name_en"` Description string `json:"description"` BCSClusterID string `json:"bcs_cluster_id"` FileIndexSetID int `json:"file_index_set_id"` STDIndexSetID int `json:"std_index_set_id"` RuleFileIndexSetID int `json:"rule_file_index_set_id"` RuleSTDIndexSetID int `json:"rule_std_index_set_id"` IsSTDDeleted bool `json:"is_std_deleted"` IsFileDeleted bool `json:"is_file_deleted"` Creator string `json:"created_by"` Updator string `json:"updated_by"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` AddPodLabel bool `json:"add_pod_label"` ExtraLabels []Label `json:"extra_labels"` ContainerConfig []ContainerConfig `json:"container_config"` FromBKLog bool `json:"from_bklog"` }
ListBCSCollectorRespData xxx
func ListLogCollectors ¶
func ListLogCollectors(ctx context.Context, clusterID, spaceUID string) ([]ListBCSCollectorRespData, error)
ListLogCollectors list log collectors
func ListLogCollectorsWithPath ¶
func ListLogCollectorsWithPath(ctx context.Context, clusterID, spaceUID string, path string) ([]ListBCSCollectorRespData, error)
ListLogCollectorsWithPath list log collectors
func (*ListBCSCollectorRespData) Message ¶
func (resp *ListBCSCollectorRespData) Message() string
Message return log message
func (*ListBCSCollectorRespData) Status ¶
func (resp *ListBCSCollectorRespData) Status() string
Status return log status
func (*ListBCSCollectorRespData) ToLogRule ¶
func (resp *ListBCSCollectorRespData) ToLogRule() LogRule
ToLogRule trans resp to log rule
type LogRule ¶
type LogRule struct { AddPodLabel bool `json:"add_pod_label"` ExtraLabels []Label `json:"extra_labels"` LogRuleContainer LogRuleContainer `json:"config"` DataInfo DataInfo `json:"data_info"` }
LogRule log rule
type LogRuleContainer ¶
type LogRuleContainer struct { Namespaces []string `json:"namespaces"` Paths []string `json:"paths"` DataEncoding string `json:"data_encoding"` EnableStdout bool `json:"enable_stdout"` Conditions *Conditions `json:"conditions,omitempty"` LabelSelector LabelSelector `json:"label_selector,omitempty"` Container Container `json:"container,omitempty"` Multiline *Multiline `json:"multiline,omitempty"` }
LogRuleContainer log rule container config
type Multiline ¶
type Multiline struct { MultilinePattern string `json:"multiline_pattern"` MultilineMaxLines json.Number `json:"multiline_max_lines"` MultilineTimeout json.Number `json:"multiline_timeout"` }
Multiline multi line
type Params ¶
type Params struct { Paths []string `json:"paths"` Conditions *Conditions `json:"conditions"` Multiline }
Params container config params
type QueryLogResp ¶
type QueryLogResp struct { BaseResp Data struct { Hits struct { Total int `json:"total"` } `json:"hits"` } `json:"data"` }
QueryLogResp query log resp
type SeparatorFilters ¶
type SeparatorFilters struct { FieldIndex json.Number `json:"fieldindex"` // 匹配项所在列 LogicOp string `json:"logic_op"` // and, or Op string `json:"op"` // 匹配方式,目前只有 = Word string `json:"word"` // 匹配值 }
SeparatorFilters 分隔符过滤条件
func (SeparatorFilters) IntFieldIndex ¶
func (s SeparatorFilters) IntFieldIndex() int
IntFieldIndex get int field index
type StdoutConf ¶
type StdoutConf struct { BkDataID int `json:"bk_data_id"` BKDataDataID int `json:"bkdata_data_id"` // 计算平台 dataid }
StdoutConf stdout config
type UpdateBCSCollectoRespData ¶
type UpdateBCSCollectoRespData struct { RuleID json.Number `json:"rule_id"` FileIndexSetID int `json:"file_index_set_id"` STDIndexSetID int `json:"std_index_set_id"` RuleFileIndexSetID int `json:"rule_file_index_set_id"` RuleSTDIndexSetID int `json:"rule_std_index_set_id"` BKDataID int `json:"bk_data_id"` StdoutConf StdoutConf `json:"stdout_conf"` }
UpdateBCSCollectoRespData xxx
func UpdateLogCollectors ¶
func UpdateLogCollectors(ctx context.Context, ruleID int, req *UpdateBCSCollectorReq) (*UpdateBCSCollectoRespData, error)
UpdateLogCollectors update log collectors
func (*UpdateBCSCollectoRespData) GetRuleID ¶
func (u *UpdateBCSCollectoRespData) GetRuleID() int
GetRuleID get rule id, rule id is int or string
type UpdateBCSCollectorReq ¶
type UpdateBCSCollectorReq struct { SpaceUID string `json:"space_uid"` ProjectID string `json:"project_id"` CollectorConfigName string `json:"collector_config_name"` CollectorConfigNameEN string `json:"collector_config_name_en"` Description string `json:"description"` BCSClusterID string `json:"bcs_cluster_id"` AddPodLabel bool `json:"add_pod_label"` ExtraLabels []Label `json:"extra_labels"` LogRuleContainer []LogRuleContainer `json:"config"` }
UpdateBCSCollectorReq req
func (*UpdateBCSCollectorReq) String ¶
func (req *UpdateBCSCollectorReq) String() string
String get req json string
type UpdateBCSCollectorResp ¶
type UpdateBCSCollectorResp struct { BaseResp Data UpdateBCSCollectoRespData `json:"data"` }
UpdateBCSCollectorResp xxx