MacOS
View all Worklets
MacOSmacOS

macOS - Forensics - Get Automox Agent Log (Amagent.log)

Retrieve Automox Agent log contents from macOS endpoints for troubleshooting and diagnostics

Worklet Details

What the Agent Log Retrieval Worklet does

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".

Why retrieve Automox Agent logs remotely

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.

How Agent log retrieval works

  1. 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.

  2. 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.

Agent log retrieval requirements

  • 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

Expected log output in Activity Log

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.

How to validate get automox agent log (amagent.log) changes

  1. Run this Worklet on a pilot macOS endpoint and review evaluation output for get automox agent log (amagent.log).

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as exit, else.

  4. 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.

View in app
evalutation image
remediation image

Consider Worklets your easy button

What's a Worklet?

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.

do more with worklets