package filehandler
import "github.com/TLop503/LogCrunch/server/filehandler"
Index
- Constants
- func LogFileToData() (*structs.IntakeLogFileData, error)
- func RotateFile(filePath string, rotationDestination string, append bool) error
- func WriteToFile(path string, create bool, append bool, payload interface{}) error
Constants
const LOG_INTAKE_DESTINATION = "/var/log/LogCrunch/firehose.log"
Path to where
Functions
func LogFileToData
func LogFileToData() (*structs.IntakeLogFileData, error)
func RotateFile
func RotateFile(filePath string, rotationDestination string, append bool) error
RotateFile copies the contents of a file to a new location for archival purposes. filePath is the original file, rotationDestination is the new or existing file to write to append defines whether to append (true) or overwrite (false) any potentially existing data by default if the rotationDestination does not exist it will be created. Note! if file to rotate does not exist, this function just does nothing w/o error
func WriteToFile
func WriteToFile(path string, create bool, append bool, payload interface{}) error
WriteToFile writes a payload to a file, creating or appending based on flags. payload can be a string or any value that can be marshaled to JSON.