// writeFile writes flagged events to an output file
writeFile writes flagged events to an output file
// writeFile writes flagged events to an output file
func writeFile(lines []string, outputDir, filePath string) (totalName string, err error) {
	if len(lines) == 0 {
		return
	}
	currTime := time.Now().Format("2006.01.02.15")
	fileName := filepath.Base(filePath)
	basePath := filepath.Dir(filePath)
	totalPath := outputDir + basePath
	totalName = totalPath + "/" + fileName + "." + currTime
	err = os.MkdirAll(totalPath, 0777)
	if err != nil {
		return totalName, log.Error("Error creating output dir: ", err)
	}
	file, err := os.Create(totalName)
	if err != nil {
		return totalName, log.Error("Error Opening OutputFile: ", err)
	}
	defer file.Close()
	for _, line := range lines {
		file.WriteString(line)
	}
	return totalName, nil
}
func writeFile ( lines [ ] string , outputDir , filePath string ) ( totalName string , err error ) { if len ( lines ) == 0 { return } currTime := time . Now ( ) . Format ( " " ) fileName := filepath . Base ( filePath ) basePath := filepath . Dir ( filePath ) totalPath := outputDir + basePath totalName = totalPath + " " + fileName + " " + currTime err = os . MkdirAll ( totalPath , 0777 ) if err != nil { return totalName , log . Error ( " " , err ) } file , err := os . Create ( totalName ) if err != nil { return totalName , log . Error ( " " , err ) } defer file . Close ( ) for _ , line := range lines { file . WriteString ( line ) } return totalName , nil }
writeFile writes flagged events to an output file
writeFile writes flagged events to an output file