This script creates a csv file from the audit log filtered by the User Access category, so dates of when users logged in or logged out.
*** see update below *** Note: The csv file has the same name as the Groovy script and does NOT have the .csv extension . To get the .csv extension, the Groovy script has to be renamed to AuditEntryToCSV.csv.groovy . Suggestions on how to improve this are welcome.
*** Update ***: The download works without the renamed groovy script by returning text instead of an input stream. The script has been modified to illustrate this.
days - the number of days past to fetch audit logs