Worklet: Display amagent.log contents in Activity Log for Linux and macOS
The following Worklet provides for three possible outputs to the Activity log from the local amagent.log
Requirements:
- macOS or Linux device
- Automox Agent 35+
Create a new Worklet, see Creating a Worklet
Evaluation Code:
exit 1
Remediation Code for the entire log:
#Entire log echo "$(</var/log/amagent/amagent.log)"
Remediation Code for the most recent 100 lines:
#Last 100 lines touch temp-log.log tail -100 /var/log/amagent/amagent.log >> temp-log.log echo "$(<temp-log.log)"
Altering the number after tail will allow for other numbers of lines to be chosen. Example: 20 lines would be tail -20 /var/log/amagent/amagent.log >> temp-log.log
Remediation Code for starting from a specific date:
#Logs from a specific date touch temp-log.log cat /var/log/amagent/amagent.log | grep 2022/06/02 >> temp-log.log echo "$(<temp-log.log)"
Altering the date after grep will choose the starting date.
Example for October 9th is:
cat /var/log/amagent/amagent.log | grep 2022/10/09 >> temp-log.log