logdumper

package
v0.0.0-...-9625d7e Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Extractors []extractor
View Source
var WindowsOsLogRecord *windowslog.WindowsOsLogRecorder

Functions

func CleanInvalidStatesInLocal

func CleanInvalidStatesInLocal()

Clean the invalid states in Record to upgrade the performance

func CreateExtractors

func CreateExtractors()

func Extract

func Extract(data chan FileEvent)

func ExtractOsLog

func ExtractOsLog(data chan FileEvent)

收集操作系统日志

func GetStatesFromRecordFile

func GetStatesFromRecordFile() *file.FileStates

decode the states from local record file

func InitExtractorsFilesOffset

func InitExtractorsFilesOffset()

func LoadExtractors

func LoadExtractors() []extractor

func PersistFileStateInLocal

func PersistFileStateInLocal(state file.FileState)

backup the record file into local

func ReWriteRecordFile

func ReWriteRecordFile(fileStates *file.FileStates) error

write the new states into the local Record file

func ReloadExtractors

func ReloadExtractors()

func UpdateFileStateFileName

func UpdateFileStateFileName(fileStates *file.FileStates, extractors []extractor) (newFileStates *file.FileStates)

update attribute filePath in FileState

Types

type Collector

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

type ErrorResponse

type ErrorResponse struct {
	Message ErrorResponseMessage `json:"message"`
}

type ErrorResponseMessage

type ErrorResponseMessage struct {
	Details string `json:"details"`
	Code    string `json:"code"`
}

type Event

type Event struct {
	Message    string `json:"message" required:"true" max:"256KB"`
	Time       uint64 `json:"time" required:"true"`
	Path       string `json:"path" required:"true"`
	Ip         string `json:"ip" required:"true"`
	HostName   string `json:"host_name" required:"true"`
	LineNumber uint64 `json:"line_no"`
}

func (*Event) Validate

func (e *Event) Validate() error

validate Event

type FileEvent

type FileEvent struct {
	IsWindowsOsLog            bool
	WindowsOsLogChannelState  windowslog.WindowsOsLogChannelState
	FileState                 file.FileState
	LogEvent                  LogEventMessage
	Offset                    uint64 //读取后的offset
	ErrRes                    ErrorResponse
	ResponseStr               string
	ResStatusCode             int
	SuccessPreProcessLogEvent bool //before send to server,log need to be marshaled and compressed,it's flaged the status
}

func (*FileEvent) SendLogDataToServer

func (fileEvent *FileEvent) SendLogDataToServer()

send the log event from file event to server

type LogEventMessage

type LogEventMessage struct {
	LogEvents  []Event `json:"log_events" required:"true" len:"20"`
	LogTopicId string  `json:"log_topic_id" required:"true"`
	LogGroupId string  `json:"log_group_id" required:"true"`
}

func (*LogEventMessage) Validate

func (e *LogEventMessage) Validate() error

validate log event message

type MetaData_

type MetaData_ struct {
	HasEventsTooOld bool `json:"has_events_too_old"`
	IsLogTooLarge   bool `json:"is_log_too_large"`
	TopicNotExist   bool `json:"topic_or_group_not_exist"`
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}
var Record Recorder

func (*Recorder) FileStateExistInRecord

func (p *Recorder) FileStateExistInRecord(newFileState file.FileState) *file.FileState

if oldstate exist in memory,then return ,whether return {}

func (*Recorder) InitRecord

func (p *Recorder) InitRecord()

initialize

func (*Recorder) UpdateRecord

func (p *Recorder) UpdateRecord(fileState file.FileState, offset uint64, lineNumber uint64)

backup the record file into local update record file when success to send a log request to server

func (*Recorder) UpdateState

func (p *Recorder) UpdateState(fileState file.FileState)

update State in Mem

type Response

type Response struct {
	StatusCode      int       `json:_`
	MetaData        MetaData_ `json:"meta_data"`
	SuccessPutCount int       `json:"success_put_count"`
}

Jump to

Keyboard shortcuts

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