Documentation
¶
Index ¶
- Constants
- Variables
- func ChartsIntervalConvert(interval int64) (standard int64)
- func Run(req Request) (data view.RespAgentSearch, err error)
- func RunCharts(req Request) (resp view.RespAgentChartsSearch, err error)
- func TrimKeyWord(keyWord string) string
- type Bash
- type CmdRequest
- type Component
- type Container
- type File
- type KeySearch
- type LogRes
- type OffsetSection
- type Options
- type Request
- type Scanner
Constants ¶
const ( // DefaultChunkSize is the default value for the ChunkSize option DefaultChunkSize = 1024 // DefaultMaxBufferSize is the default value for the MaxBufferSize option DefaultMaxBufferSize = 1 << 20 // 1 MB )
const ( InnerKeyContainer = "_container" InnerKeyFile = "_file" InnerKeyNamespace = "_namespace" InnerKeyPod = "_pod" )
const ( KB = 1024 MB = 1024 * KB GB = 1024 * MB PARTITION_MAX_SIZE = 4 * MB PARTITION_MAX_NUM = 10 )
const (
SkipPath = "clickvisual"
)
Variables ¶
var ( // ErrLongLine indicates that the line is longer than the internal buffer size ErrLongLine = errors.New("line too long") )
var SkipKeys = map[string]interface{}{ InnerKeyContainer: struct{}{}, InnerKeyFile: struct{}{}, InnerKeyNamespace: struct{}{}, InnerKeyPod: struct{}{}, }
Functions ¶
func ChartsIntervalConvert ¶
func TrimKeyWord ¶
Types ¶
type Bash ¶
type CmdRequest ¶
type CmdRequest struct { StartTime string EndTime string Date string // last 30min,6h,1d,7d Path string // 文件路径 Dir string // 文件夹路径 KeyWord string // 搜索的关键词 Limit int64 // 最少多少条数据 IsK8S bool K8SContainer []string }
func (CmdRequest) ToRequest ¶
func (c CmdRequest) ToRequest() Request
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component 每个执行指令地方
func NewComponent ¶
func NewComponent(targetInfo dto.AgentSearchTargetInfo, req Request) (*Component, error)
func (*Component) IsChartRequest ¶
func (*Component) SearchFile ¶
* searchFile 搜索文件内容 * searchFile 2023-09-28 10:10:00 2023-09-28 10:20:00 /xxx/your_service.log`
type File ¶
type File struct {
// contains filtered or unexported fields
}
File contains file related information
type KeySearch ¶
func Keyword2Array ¶
type LogRes ¶
type LogRes struct { // Code means response business code Code int `json:"code"` // Msg means response extra message Msg string `json:"msg"` // Data means response data payload Data view.RespAgentSearch `json:"data"` }
LogRes defines HTTP JSON response
type OffsetSection ¶
type OffsetSection struct {
// contains filtered or unexported fields
}
This structure is mainly used to record the maximum pos belonging to the same offset when searching, and the number of rows that have been searched for a match
type Options ¶
type Options struct { // ChunkSize specifies the size of the chunk that is read at once from the input. ChunkSize int64 // MaxBufferSize limits the maximum size of the buffer used internally. // This also limits the max line size. MaxBufferSize int64 }
Options contains parameters that influence the internal working of the Scanner.
type Request ¶
type Request struct { StartTime int64 EndTime int64 Date string // last 30min,6h,1d,7d Path string // 文件路径 Dir string // 文件夹路径 TruePath []dto.AgentSearchTargetInfo KeyWord string // 搜索的关键词 Limit int64 // 最少多少条数据 IsCommand bool // 是否是命令行 默认不是 IsUploadExcel bool // Namespace string // 指定namespace IsK8S bool K8SContainer []string K8sClientType string // 是 containerd,还是docker IsChartRequest bool // 是否为请求 Charts IsAllCurl bool Interval int64 // 请求 charts 时,划分的标准时间间隔 }
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is the back-scanner implementation.
func NewOptions ¶
NewOptions returns a new Scanner with the given Options. Invalid option values are replaced with their default values.
func (*Scanner) Line ¶
Line returns the next line from the input and its absolute byte-position. Line ending is cut from the line. Empty lines are also returned. After returning the last line (which is the first in the input), subsequent calls report io.EOF.
func (*Scanner) LineBytes ¶
LineBytes returns the bytes of the next line from the input and its absolute byte-position. Line ending is cut from the line. Empty lines are also returned. After returning the last line (which is the first in the input), subsequent calls report io.EOF.
This method is for efficiency if you need to inspect or search in the line. The returned line slice shares data with the internal buffer of the Scanner, and its content may be overwritten in subsequent calls to LineBytes() or Line(). If you need to retain the line data, make a copy of it or use the Line() method.