mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

This is a verbose, opinionated and fairly restrictive version of the log delay idea. Main drivers are explicitly, foot-gun-avoidance and implementation simplicity. Calling the new Log::delay() function is only allowed within the execution of a Log::log_stream_policy() hook for the currently active log write. Conceptually, the delay is placed between the execution of the global stream policy hook and the individual filter policy hooks. A post delay callback can be registered with every Log::delay() invocation. Post delay callbacks can (1) modify a log record as they see fit, (2) veto the forwarding of the log record to the log filters and (3) extend the delay duration by calling Log::delay() again. The last point allows to delay a record by an indefinite amount of time, rather than a fixed maximum amount. This should be rare and is therefore explicit. Log::delay() increases an internal reference count and returns an opaque token value to be passed to Log::delay_finish() to release a delay reference. Once all references are released, the record is forwarded to all filters attached to a stream when the delay completes. This functionality separates Log::log_stream_policy() and individual filter policy hooks. One consequence is that a common use-case of filter policy hooks, removing unproductive log records, may run after a record was delayed. Users can lift their filtering logic to the stream level (or replicate the condition before the delay decision). The main motivation here is that deciding on a stream-level delay in per-filter hooks is too late. Attaching multiple filters to a stream can additionally result in hard to understand behavior. On the flip side, filter policy hooks are guaranteed to run after the delay and can be used for further mangling or filtering of a delayed record.
16 lines
1.1 KiB
Text
16 lines
1.1 KiB
Text
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
ts|post_ts|write_ts|msg
|
|
1362692526.869344|1362692527.009512|1362692527.009721|packet number 1
|
|
1362692526.939084|1362692527.009512|1362692527.009721|packet number 2
|
|
1362692526.939378|1362692527.009512|1362692527.009765|packet number 3
|
|
1362692526.939527|1362692527.009512|1362692527.009775|packet number 4
|
|
1362692527.008509|1362692527.009512|1362692527.009855|packet number 5
|
|
1362692527.009512|1362692527.009512|1362692527.009887|packet number 6
|
|
1362692527.009721|1362692527.011846|1362692527.080828|packet number 7
|
|
1362692527.009765|1362692527.011846|1362692527.080828|packet number 8
|
|
1362692527.009775|1362692527.011846|1362692527.080972|packet number 9
|
|
1362692527.009855|1362692527.011846|1362692527.080972|packet number 10
|
|
1362692527.009887|1362692527.011846|1362692527.080972|packet number 11
|
|
1362692527.011846|1362692527.011846|1362692527.080972|packet number 12
|
|
1362692527.080828|1362692527.080972|1362692527.080972|packet number 13
|
|
1362692527.080972|1362692527.080972|1362692527.080972|packet number 14
|