Vlad Previn
06/07/2023, 11:24 AMVlad Previn
06/07/2023, 11:25 AM--enable_windows_events_subscriber=true
--enable_windows_events_publisher=true
--enable_powershell_events_subscriber=true
--events_optimize=true
--events_max=200000
--events_expiry=86400
--disable_events=false
--windows_event_channels=System,Application,Setup,Security.....
Vlad Previn
06/07/2023, 11:43 AMfleetctl package type=msi ... --osquery-flagfile osq.flags
Vlad Previn
06/07/2023, 11:49 AMVlad Previn
06/07/2023, 12:50 PMVlad Previn
06/07/2023, 12:50 PMwindows_eventlog
with xpath constraints for the channel, event id and time ?
SELECT * FROM windows_eventlog WHERE xpath='<QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[(Level=2) and (EventID=123) and TimeCreated[timediff(@SystemTime) <= 86400000]]]</Select></Query></QueryList>'
Vlad Previn
06/07/2023, 12:57 PMselect * from windows_events
or is the intention with this querying all of it for the all events in channels it tracks and flushes each scheduled query call?Vlad Previn
06/07/2023, 1:05 PMVlad Previn
06/08/2023, 5:41 AMLucas Rodriguez
06/08/2023, 2:48 PMThis looks correct. When it comes to flushing of logged events in osquery, there's thefleetctl package --type=msi ... --osquery-flagfile osq.flags
--events_expiry
flag:
The buffered events will eventually expire! The --events_expiry flag controls the lifetime of buffered events. This is set to 1 day by default, this expiration occurs when events are selected from their subscriber table. For example: the process_events subscriber will buffer process starts until a query selects from this table. At that point all results will be returned and immediately after, any event that happened time-86400 seconds ago will be deleted. If you select from this table every second you will constantly see a window of 1 day's worth of process events.
Source: https://osquery.readthedocs.io/en/stable/development/pubsub-framework/Lucas Rodriguez
06/08/2023, 2:50 PM--events_optimize=true
when using *_events
table in scheduled queries:
When scheduling queries that include _events (subscriber-based) tables, additional optimizations are invoked. These optimization can be disabled using --events_optimize=false. The subscriber tables can detect they are responding to a schedule and may keep track of the last time the scheduled query has executed. This allows each subscriber to return the exact window of the schedule and delete buffered events immediately. This saves the most memory and disk usage possible while still allowing flexible scheduling.
Lucas Rodriguez
06/08/2023, 2:50 PMVlad Previn
06/08/2023, 2:59 PM