Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce and make use of the timestamp type #1388

Merged
merged 17 commits into from
Feb 22, 2021
Merged

Conversation

tobim
Copy link
Member

@tobim tobim commented Feb 18, 2021

📔 Description

📝 Checklist

  • All user-facing changes have changelog entries.
  • The changes are reflected on docs.tenzir.com/vast, if necessary.
  • The PR description contains instructions for the reviewer, if necessary.
  • Remove dead code.

🎯 Review Instructions

By commit.

@tobim tobim requested a review from a team February 18, 2021 17:28
@tobim tobim force-pushed the story/ch22707/timestamp-type branch from f874a64 to 7316487 Compare February 18, 2021 17:35
@tobim tobim changed the title Introduce and make use of the timestamp type.\ Introduce and make use of the timestamp type Feb 18, 2021
@tobim tobim changed the base branch from master to story/ch22834/udt-type-extractor February 18, 2021 17:37
@tobim tobim force-pushed the story/ch22707/timestamp-type branch from 7316487 to f031c29 Compare February 18, 2021 19:39
libvast/src/concept/parseable/vast/type.cpp Outdated Show resolved Hide resolved
libvast/src/type.cpp Show resolved Hide resolved
Copy link
Member

@mavam mavam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks clean. Green light.

Before approving, we still need to give it a spin locally.

Also, while we're at it: What happens with aliases of aliases? Say I have type foo = timestamp. Will the symmetric difference between the result of :foo: and :timestamp queries be the strict delta to :timestamp? In other words, will :foo include the results of :timestamp?

libvast/src/table_slice.cpp Show resolved Hide resolved
libvast/src/concept/parseable/vast/type.cpp Outdated Show resolved Hide resolved
libvast/src/system/explorer.cpp Show resolved Hide resolved
libvast/src/system/explorer.cpp Outdated Show resolved Hide resolved
@mavam
Copy link
Member

mavam commented Feb 19, 2021

@tobim: one todo: please add an integration that uses something like :timestamp <= X && :timestamp >= Y

Copy link
Member

@dominiklohmann dominiklohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general functionality works. You missed some things, though:

❯ git grep '#timestamp' -- ':(exclude)CHANGELOG.md'
README.md:vast export json '#timestamp > 1 hour ago && (6.6.6.6 || 5353/udp)'
doc/cli/vast-explore.md:`--before`, or `--context`) apply relative to the #timestamp field of the
doc/cli/vast-export.md:vast export --max-events=100 --continuous json '#timestamp < 1 hour ago'
doc/cli/vast-export.md:`#timestamp` attribute will be exported, and only if the timestamp in that field
doc/cli/vast-import-json.md:`#timestamp` or `#skip`.
libvast/src/concept/parseable/vast/expression.cpp:    VAST_WARN("#timestamp queries are deprecated and should be replaced with "
libvast/test/expression_evaluation.cpp:TEST(evaluation - attribute extractor - #timestamp) {
libvast/test/expression_evaluation.cpp:  auto expr = make_conn_expr("#timestamp <= 2009-11-18T08:09");
libvast/test/expression_parseable.cpp:  MESSAGE("now > #timestamp");
libvast/test/expression_parseable.cpp:  str = "now > #timestamp";
libvast/test/expression_parseable.cpp:    "#timestamp > 2018-07-04+12:00:00.0 && #timestamp < 2018-07-04+23:55:04.0"s,
libvast/test/meta_index.cpp:    std::string q = "#timestamp == 1970-01-01+";
libvast/test/meta_index.cpp:    std::string q = "#timestamp >= 1970-01-01+";
libvast/test/meta_index.cpp:    q += " && #timestamp <= 1970-01-01+";
libvast/test/system/query_processor.cpp:constexpr std::string_view query_str = "#timestamp < 1 week ago";
pyvast/pyvast/test_vast.py:        query = "#timestamp < 1 hour ago"
pyvast/pyvast/test_vast.py:        query = ":addr == 192.168.1.104 && #timestamp < 1 hour ago"
scripts/generate-sysmon-schema.py:        return "time #timestamp"
vast/integration/default_set.yaml:      - command: '-N count "#timestamp >= 1970-01-01 && #type != \"vast.metrics\""'
vast/integration/default_set.yaml:      - command: 'count "#timestamp >= 1970-01-01 && #type != \"vast.metrics\""'
vast/integration/default_set.yaml:      - command: -N export ascii '#timestamp >= 2011-08-15T03:48'
vast/integration/misc/schema/argus.schema:  StartTime: time #timestamp,

CHANGELOG.md Show resolved Hide resolved
libvast/vast/type.hpp Show resolved Hide resolved
vast/integration/misc/schema/zeek-conn.schema Show resolved Hide resolved
@tobim
Copy link
Member Author

tobim commented Feb 19, 2021

one todo: please add an integration that uses something like :timestamp <= X && :timestamp >= Y

I simply changed the #timestamp extractions to :timestamp, because the former is deprecated anyway.

@tobim tobim force-pushed the story/ch22707/timestamp-type branch from 368a869 to 8405ac4 Compare February 19, 2021 12:33
@tobim tobim force-pushed the story/ch22834/udt-type-extractor branch from 8d3d115 to 73d615c Compare February 19, 2021 15:43
Copy link
Member

@mavam mavam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side. Not sure if @dominiklohmann has something to add.

;
return type_type(f, l, a);
// Bogus indentation from clang-format ¯\_(ツ)_/¯
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked that guy 😉

@dominiklohmann
Copy link
Member

My feedback is still the same @mavam:

❯ git grep '#timestamp' -- ':(exclude)CHANGELOG.md'
README.md:vast export json '#timestamp > 1 hour ago && (6.6.6.6 || 5353/udp)'
doc/cli/vast-explore.md:`--before`, or `--context`) apply relative to the #timestamp field of the
doc/cli/vast-export.md:vast export --max-events=100 --continuous json '#timestamp < 1 hour ago'
doc/cli/vast-export.md:`#timestamp` attribute will be exported, and only if the timestamp in that field
doc/cli/vast-import-json.md:`#timestamp` or `#skip`.
libvast/src/concept/parseable/vast/expression.cpp:    VAST_WARN("#timestamp queries are deprecated and should be replaced with "
libvast/test/expression_evaluation.cpp:TEST(evaluation - attribute extractor - #timestamp) {
libvast/test/expression_evaluation.cpp:  auto expr = make_conn_expr("#timestamp <= 2009-11-18T08:09");
libvast/test/expression_parseable.cpp:  MESSAGE("now > #timestamp");
libvast/test/expression_parseable.cpp:  str = "now > #timestamp";
libvast/test/expression_parseable.cpp:    "#timestamp > 2018-07-04+12:00:00.0 && #timestamp < 2018-07-04+23:55:04.0"s,
libvast/test/meta_index.cpp:    std::string q = "#timestamp == 1970-01-01+";
libvast/test/meta_index.cpp:    std::string q = "#timestamp >= 1970-01-01+";
libvast/test/meta_index.cpp:    q += " && #timestamp <= 1970-01-01+";
libvast/test/system/query_processor.cpp:constexpr std::string_view query_str = "#timestamp < 1 week ago";
pyvast/pyvast/test_vast.py:        query = "#timestamp < 1 hour ago"
pyvast/pyvast/test_vast.py:        query = ":addr == 192.168.1.104 && #timestamp < 1 hour ago"
scripts/generate-sysmon-schema.py:        return "time #timestamp"
vast/integration/misc/schema/argus.schema:  StartTime: time #timestamp,

Please change these as well.

Base automatically changed from story/ch22834/udt-type-extractor to master February 22, 2021 11:50
tobim and others added 12 commits February 22, 2021 12:52
The `attr_list` parser is now only called once for the final type
instead of for each alternative directly. The placeholder parser
is back in it's old place.
The rewriting of the `#timestamp` query in the parsing step would
otherwise make it impossible to extract data that is already in a
db with the type `time #timestamp`.

A section in this code is marked DEPRECATED and should be removed
after a reasonable grace period.
@tobim tobim force-pushed the story/ch22707/timestamp-type branch from a711d8e to c09ea02 Compare February 22, 2021 11:54
@tobim tobim merged commit a68f667 into master Feb 22, 2021
@tobim tobim deleted the story/ch22707/timestamp-type branch February 22, 2021 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants