input

package
v5.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: May 2, 2016 License: Apache-2.0 Imports: 7 Imported by: 1,618

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRegularFile

func IsRegularFile(file *os.File) bool

func IsSameFile

func IsSameFile(path string, info os.FileInfo) bool

IsSameFile checks if the given File path corresponds with the FileInfo given

func ReadOpen

func ReadOpen(path string) (*os.File, error)

ReadOpen opens a file for reading only

func SafeFileRotate

func SafeFileRotate(path, tempfile string) error

SafeFileRotate safely rotates an existing file under path and replaces it with the tempfile

Types

type File

type File struct {
	File      *os.File
	FileInfo  os.FileInfo
	Path      string
	FileState *FileState
}

func NewFile

func NewFile(fileInfo os.FileInfo) File

NewFile create new File object

func (*File) IsRegularFile

func (f *File) IsRegularFile() bool

Check that the file isn't a symlink, mode is regular or file is nil

func (*File) IsSameFile

func (f *File) IsSameFile(f2 *File) bool

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   *config.JSONConfig
	Stat         *FileStat
	FileState    FileState
}

FileEvent is sent to the output and must contain all relevant information

func (*FileEvent) ToMapStr

func (f *FileEvent) ToMapStr() common.MapStr

type FileStat

type FileStat struct {
	Fileinfo      os.FileInfo /* the file info */
	Offset        chan int64  /* the harvester will send an event with its offset when it closes */
	LastIteration uint32      /* int number of the last iterations in which we saw this file */
}

Contains statistic about file when it was last seen by the prospector

func NewFileStat

func NewFileStat(fi os.FileInfo, lastIteration uint32) *FileStat

func (*FileStat) Continue

func (fs *FileStat) Continue(old *FileStat)

func (*FileStat) Finished

func (fs *FileStat) Finished() bool

func (*FileStat) Ignore

func (fs *FileStat) Ignore()

Ignore forgets about the previous harvester results and let it continue on the old file - start a new channel to use with the new harvester.

func (*FileStat) Skip

func (fs *FileStat) Skip(newOffset int64)

type FileState

type FileState struct {
	Source      string `json:"source,omitempty"`
	Offset      int64  `json:"offset,omitempty"`
	FileStateOS FileStateOS
}

type FileStateOS

type FileStateOS struct {
	Inode  uint64 `json:"inode,omitempty"`
	Device uint64 `json:"device,omitempty"`
}

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

Jump to

Keyboard shortcuts

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