Method: Jamf::Policy.flush_logs
- Defined in:
- lib/jamf/api/classic/api_objects/policy.rb
.flush_logs(policy, older_than: 0, period: :days, api: nil, cnx: Jamf.cnx) ⇒ void
This method returns an undefined value.
Flush logs for a given policy older than a given time period. This flushes the logs of the given policy for all computers.
IMPORTANT: from the Jamf Developer Site:
The ability to flush logs is currently only supported for flushing all logs
for a given policy or all logs for a given computer. There is no support for
flushing logs for a given policy and computer combination.
(See .flush_logs_for_computers to to flush all logs for given computers)
With no parameters, flushes all logs for the policy.
Without older_than: and period:, will flush all logs for the policy
NOTE: Currently the API doesn’t have a way to flush only failed policies.
WARNING: Log flushing can take a long time, and the API call doesnt return until its finished. The connection timeout will be temporarily raised to 30 minutes, unless it’s already higher.
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/jamf/api/classic/api_objects/policy.rb', line 326 def self.flush_logs(policy, older_than: 0, period: :days, api: nil, cnx: Jamf.cnx) cnx = api if api pol_id = valid_id policy, cnx: cnx raise Jamf::NoSuchItemError, "No Policy identified by '#{policy}'." unless pol_id older_than, period = validate_log_flush_params(older_than, period) # log flushes can be really slow orig_timeout = cnx.timeout cnx.timeout = 1800 unless orig_timeout && orig_timeout > 1800 cnx.c_delete "#{LOG_FLUSH_RSRC}/policy/id/#{pol_id}/interval/#{older_than}+#{period}" ensure cnx.timeout = orig_timeout end |