Skip to content

Commit

Permalink
Support --strict for all JSON sources
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiklohmann committed Jun 4, 2020
1 parent 628df03 commit 5ce0f19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libvast/src/system/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ auto make_import_command() {
import_->add_subcommand("csv", "imports CSV logs from STDIN or file",
documentation::vast_import_csv,
source_opts("?import.csv"));
import_->add_subcommand(
"json", "imports JSON with schema", documentation::vast_import_json,
source_opts("?import.json").add<bool>("strict", "strict type matching"));
import_->add_subcommand("json", "imports JSON with schema",
documentation::vast_import_json,
json_source_opts("?import.json"));
import_->add_subcommand("suricata", "imports suricata eve json",
documentation::vast_import_suricata,
source_opts("?import.suricata"));
json_source_opts("?import.suricata"));
import_->add_subcommand("syslog", "imports syslog messages",
documentation::vast_import_syslog,
source_opts("?import.syslog"));
Expand Down Expand Up @@ -470,6 +470,10 @@ command::opts_builder source_opts(std::string_view category) {
.add<bool>("uds,d", "treat -r as listening UNIX domain socket");
}

command::opts_builder json_source_opts(std::string_view category) {
return source_opts(category).add<bool>("strict", "strict type matching");
}

command::opts_builder sink_opts(std::string_view category) {
return command::opts(category)
.add<std::string>("write,w", "path to write events to")
Expand Down
3 changes: 3 additions & 0 deletions libvast/vast/system/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ void render_error(const command& root, const caf::error& err, std::ostream& os);
/// @returns default options for source commands.
command::opts_builder source_opts(std::string_view category);

/// @returns default options for JSON source commands.
command::opts_builder json_source_opts(std::string_view category);

/// @returns defaults options for sink commands.
command::opts_builder sink_opts(std::string_view category);

Expand Down

0 comments on commit 5ce0f19

Please sign in to comment.