Retrieve Automox Agent log contents from macOS endpoints for troubleshooting and diagnostics
This Automox Worklet™ reads the Automox Agent log file located at /var/log/amagent/amagent.log on macOS endpoints and outputs the contents to your Automox Activity Log in the console. This gives you remote visibility into agent operations without requiring direct access to the endpoint.
The Worklet operates in four configurable modes: retrieve the last N lines (default 100), retrieve the entire log file, retrieve all entries from a specific date, or retrieve the last N lines from a specific date. You select the mode by setting the worklet_mode variable in the remediation script.
log".
Organizations face operational challenges that require automated solutions. The amagent.log file contains detailed information about agent operations, including policy executions, patch installations, scan results, and communication with the Automox console. When endpoints exhibit unexpected behavior, these logs are essential for diagnosis.
Remote log retrieval eliminates the need for IT staff to access endpoints directly or request users to send log files manually. This accelerates troubleshooting workflows and reduces the burden on end users.
For distributed workforces with remote endpoints, this Worklet provides a standardized method to collect diagnostic information regardless of the endpoint's physical location.
Evaluation phase: The Worklet checks whether the amagent.log file exists at /var/log/amagent/amagent.log. If the file exists, the endpoint is flagged for remediation. If the file does not exist, the Worklet exits without scheduling remediation.
Remediation phase: Based on the configured worklet_mode, the Worklet uses tail, cat, or grep commands to extract the requested log content. Mode 1 retrieves the last N lines using tail. Mode 2 retrieves the full log using cat. Modes 3 and 4 filter entries by a specified date using grep. Output is sent to the Activity Log.
macOS endpoint (workstation or server)
Automox Agent installed with log file present at /var/log/amagent/amagent.log
For date-filtered modes (3 and 4), set the desired_date variable in yyyy/mm/dd format
Configure worklet_mode variable (1-4) to select retrieval method
After running, the selected portion of the amagent.log appears in your Automox Activity Log for the endpoint. The output includes timestamps, log levels, and detailed messages about agent operations. You can verify this change through the Automox Activity Log or by checking the endpoint configuration directly.
You can review entries related to policy execution, patch deployment, scan operations, and agent-to-console communication. This information helps identify errors, timeouts, or configuration issues affecting the endpoint.
Run this Worklet on a pilot macOS endpoint and review evaluation output for get automox agent log (amagent.log).
Confirm Automox activity logs show successful completion and exit code 0.
Verify endpoint state using checks aligned to evaluation script logic, such as exit, else.
Validate remediation effects from script operations such as function, tail, cat, then rerun evaluation for compliance.
For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for get automox agent log (amagent.log). This supports repeatable maintenance tasks workflows, faster change control review, and auditable compliance evidence.
Useful script references for this Worklet include evaluation operations such as exit, else and remediation operations such as function, tail, cat. Use these indicators to verify that endpoint changes match intended policy outcomes.


By submitting this form you agree to our Master Services Agreement and Privacy Policy.
Already have an account? Log in
Consider Worklets your easy button
A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

AUTOMOX + WORKLETS™
Uncover new possibilities with simple, powerful automation.
By submitting this form you agree to our Master Services Agreement and Privacy Policy