Documentation ¶
Index ¶
- func IsRegularFile(file *os.File) bool
- func IsSameFile(path string, info os.FileInfo) bool
- func ReadOpen(path string) (*os.File, error)
- func SafeFileRotate(path, tempfile string) error
- type File
- type FileEvent
- type FileState
- type FileStateOS
- type JSONConfig
- type MultilineConfig
- type States
- func (s *States) Cleanup(older time.Duration)
- func (s *States) Copy() *States
- func (s *States) Count() int
- func (s *States) FindPrevious(newState FileState) (int, FileState)
- func (s *States) GetStates() []FileState
- func (s *States) SetStates(states []FileState)
- func (s *States) Update(newState FileState)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRegularFile ¶
func IsSameFile ¶
IsSameFile checks if the given File path corresponds with the FileInfo given
func SafeFileRotate ¶
SafeFileRotate safely rotates an existing file under path and replaces it with the tempfile
Types ¶
type File ¶
func (*File) IsRegularFile ¶
Check that the file isn't a symlink, mode is regular or file is nil
func (*File) IsSameFile ¶
Checks if the two files are the same.
type FileEvent ¶
type FileEvent struct { common.EventMetadata ReadTime time.Time Source string InputType string DocumentType string Offset int64 Bytes int Text *string Fileinfo os.FileInfo JSONFields common.MapStr JSONConfig *JSONConfig FileState FileState }
FileEvent is sent to the output and must contain all relevant information
type FileState ¶
type FileState struct { Source string `json:"source"` Offset int64 `json:"offset"` Finished bool `json:"-"` // harvester state Fileinfo os.FileInfo `json:"-"` // the file info FileStateOS FileStateOS LastSeen time.Time `json:"last_seen"` }
FileState is used to communicate the reading state of a file
type FileStateOS ¶
func GetOSFileState ¶
func GetOSFileState(info os.FileInfo) FileStateOS
GetOSFileState returns the FileStateOS for non windows systems
func (FileStateOS) IsSame ¶
func (fs FileStateOS) IsSame(state FileStateOS) bool
IsSame file checks if the files are identical
type JSONConfig ¶
type MultilineConfig ¶
type MultilineConfig struct { Negate bool `config:"negate"` Match string `config:"match" validate:"required"` MaxLines *int `config:"max_lines"` Pattern *regexp.Regexp `config:"pattern"` Timeout *time.Duration `config:"timeout" validate:"positive"` }
func (*MultilineConfig) Validate ¶
func (c *MultilineConfig) Validate() error
type States ¶
type States struct {
// contains filtered or unexported fields
}
States handles list of FileState
func (*States) Cleanup ¶
Cleanup cleans up the state array. All states which are older then `older` are removed
Click to show internal directories.
Click to hide internal directories.