Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 7eecaa1

Browse files
committed
V3: filter audit_events via created_at, equals
This commit polishes the documentation: - We use the upcoming timestamp format, `YYYY-MM-DDThh:mm:ssZ`, in our documentation. Previously we used a version that supports the local timezone. That version will no longer be allowed when a future story is implemented. - We don't trouble the user with the knowledge that timestamps are often recorded with sub-second accuracy in the database. The explanation is long-winded, and adds no value to the user. The user is better left off believing that databases timestamps have a granularity of seconds (not, as in the case of PostgreSQL, microseconds). [#173517696] Authored-by: Brian Cunnie <bcunnie@vmware.com>
1 parent 5948530 commit 7eecaa1

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

app/fetchers/event_list_fetcher.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def filter(message, dataset)
4848
end
4949
else
5050
# Gotcha: unlike the other relational operators, which are hashes such as
51-
# { lt: '2020-06-29T12:34:56-07:00' }, the equals operator is simply a value, e.g.
52-
# '2020-06-29T12:34:56-07:00'.
51+
# { lt: '2020-06-30T12:34:56Z' }, the equals operator is simply a value, e.g.
52+
# '2020-06-30T12:34:56Z'.
5353
# Gotcha: the equals operator returns all resources occurring within
5454
# the span of the second (e.g. "12:34:56.00-12:34:56.9999999"), for databases store
5555
# timestamps in sub-second accuracy (PostgreSQL stores in microseconds, for example)

docs/v3/source/includes/concepts/_filters.md.erb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,16 @@ This will return all routes with hostname `"hostname1"`, `""` OR `"hostname2"`.
4444
##### Filtering on Equality
4545

4646
Fields can be filtered using equality when listing resources. Currently, only the `created_at` field
47-
is supported.
48-
49-
For example, a response to `/v3/audit_events?created_at=2020-06-29T12:34:56-07:00` will contain
50-
audit events with a `created_at` timestamp equal to `2020-06-29T13:56:40`, PDT. Most databases
51-
store timestamps with sub-second accuracy. When filtering on equality, the response will include
52-
_all_ resources within the second specified. For example, in the above query, any audit event
53-
occurring as early as `12:34:56.00` will be returned as well as any audit event occurring as late as
54-
`12:34:56.999999`.
55-
56-
Timestamps must be in ISO 8601 format.
47+
is supported. The `created_at` field expects a timestamp filter, and timestamps must be in ISO 8601
48+
format, e.g. `2020-06-30T12:34:56Z`.
5749

5850
##### Filtering on Inequality
5951

6052
Fields can be filtered using inequality when listing resources. Currently, only the `created_at`
6153
field is supported.
6254

63-
For example, a response to `/v3/audit_events?created_at[lt]=2020-06-29T13:56:40-07:00` will contain
64-
audit events with a `created_at` timestamp strictly earlier than `2020-06-29T13:56:40`, PDT.
55+
For example, a response to `/v3/audit_events?created_at[lt]=2020-06-30T12:34:56Z` will contain
56+
audit events with a `created_at` timestamp strictly earlier than `2020-06-30T12:34:56Z`.
6557

6658
Timestamps must be in ISO 8601 format.
6759

0 commit comments

Comments
 (0)