Skip to content

Commit

Permalink
File read tables should not error on bad files (#783)
Browse files Browse the repository at this point in the history
We have a variety of file reading tables that we use to parse configuration
data. Sometimes, we encounter badly formatted data. Instead of hard erroring
out, we should instead return what we can.
  • Loading branch information
directionless committed Jan 5, 2022
1 parent afecf73 commit 0ac55fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/osquery/tables/dataflattentable/tables.go
Expand Up @@ -99,7 +99,12 @@ func (t *Table) generate(ctx context.Context, queryContext table.QueryContext) (
for _, dataQuery := range tablehelpers.GetConstraints(queryContext, "query", tablehelpers.WithDefaults("*")) {
subresults, err := t.generatePath(filePath, dataQuery)
if err != nil {
return results, errors.Wrapf(err, "generating for path %s with query", filePath)
level.Info(t.logger).Log(
"msg", "failed to get data for path",
"path", filePath,
"err", err,
)
continue
}

results = append(results, subresults...)
Expand Down

0 comments on commit 0ac55fc

Please sign in to comment.