Skip to content

Commit

Permalink
Ensure file exporter truncates output file when starting (#525)
Browse files Browse the repository at this point in the history
Previously file exporter could write to existing file without truncating it.
Truncating is the desired behavior so that the file contains the new data only.
  • Loading branch information
tigrannajaryan authored Jan 30, 2020
1 parent 237bdf3 commit 1f803d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exporter/fileexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (f *Factory) createExporter(config configmodels.Exporter) (*Exporter, error
exporter, ok := exporters[cfg]

if !ok {
file, err := os.OpenFile(cfg.Path, os.O_RDWR|os.O_CREATE, 0755)
file, err := os.OpenFile(cfg.Path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1f803d7

Please sign in to comment.