How to fix report timestamps generated by aureport via cron?

1

I set up two aureport cron jobs the other day:

1 0 * * * /sbin/aureport -ts yesterday 00:00:00 | mailx -r "info@domain.com" -s "[Audit report] Summary" "user@domain.com"
1 0 * * * /sbin/aureport --tty -ts yesterday 00:00:00 | mailx -r "info@domain.com" -s "[Audit report] TTY details" "user@domain.com"

However, the e-mails I receive when I run the commands via cron don't contain any useful information. Sample output from the first cron line:

Summary Report
======================
Range of time in logs: 12/31/1969 13:00:00.000 - 12/31/1969 13:00:00.000
Selected time for report: 05/11/2016 00:00:00 - 12/31/1969 13:00:00.000
Number of changes in configuration: 0
Number of changes to accounts, groups, or roles: 0
...
Number of process IDs: 0
Number of events: 0

I know that 12/31/1969 is equivalent to "I have no idea what time this is."

On the other hand, running each command from a terminal sends an e-mail containing valid date/time ranges as well as non-empty information.

K. Doe

Posted 2016-05-12T17:11:59.580

Reputation: 13

Answers

1

Add --input-logs to the commands. It forces the command to use the logs instead of STDIN.

1 0 * * * /sbin/aureport --input-logs -ts yesterday 00:00:00 | mailx -r "info@domain.com" -s "[Audit report] Summary" "user@domain.com"
1 0 * * * /sbin/aureport --input-logs --tty -ts yesterday 00:00:00 | mailx -r "info@domain.com" -s "[Audit report] TTY details" "user@domain.com"

willseward

Posted 2016-05-12T17:11:59.580

Reputation: 26

Wow. I never expected to see a response to this question. I'm giving your suggestion a go. – K. Doe – 2016-10-28T18:02:48.440

The --input-logs option worked. Thanks! – K. Doe – 2016-10-31T22:26:26.500

No problem! I was battling the same thing myself. – willseward – 2016-11-04T00:19:08.613