func printAudits(entries []*cm15.AuditEntry) {
	for _, a := range entries {
		fmt.Printf("[%v] <%v>: %v\n", a.UpdatedAt, a.UserEmail, a.Summary)
	}
}
Prints the audit entries to console
package main
import (
	"flag"
	"fmt"
	"os"
	"strings"
	"time"
	"github.com/rightscale/rsc/cm15"
	"github.com/rightscale/rsc/rsapi"
)
func main() {
	email := flag.String("e", "", "Login email")
	pwd := flag.String("p", "", "Login password")
	account := flag.Int("a", 0, "Account id")
	host := flag.String("h", "us-3.rightscale.com", "RightScale API host")
	filterEmail := flag.String("f", "", "Audit user email for filtering audit entries")
	flag.Parse()
	if *email == "" {
		fail("Login email required")
	}
	if *pwd == "" {
		fail("Login password required")
	}
	if *account == 0 {
		fail("Account id required")
	}
	if *host == "" {
		fail("Host required")
	}
	if *filterEmail == "" {
		*filterEmail = *email
	}
	auth := rsapi.NewBasicAuthenticator(*email, *pwd, *account)
	client := cm15.New(*host, auth)
	if err := client.CanAuthenticate(); err != nil {
		fail("invalid credentials: %s", err)
	}
	ticker := time.NewTicker(time.Second)
	entries, err := fetchAuditEntries(client, *filterEmail)
	oldEntries := entries
	if err != nil {
		fail("Failed to retrieve audit entries: %v\n", err.Error())
	}
	printAudits(entries)
	for {
		select {
		case <-ticker.C:
			entries, err := fetchAuditEntries(client, *filterEmail)
			if err != nil {
				fail("Failed to retrieve audit entries: %v\n", err.Error())
			}
			printAudits(extractUnique(oldEntries, entries))
			oldEntries = entries
		}
	}
}
func fetchAuditEntries(client *cm15.API, filterEmail string) ([]*cm15.AuditEntry, error) {
	auditLocator := client.AuditEntryLocator("/api/audit_entries")
	var apiParams = rsapi.APIParams{"filter": []string{"user_email==" + filterEmail}}
	auditEntries, err := auditLocator.Index(
		tomorrow(),   
		"100",        
		yesterday(),  
		apiParams,
	)
	if err != nil {
		return auditEntries, err
	}
	return auditEntries, nil
}
func tomorrow() string {
	return formatTime(time.Now().UTC().AddDate(0, 0, 1))
}
func yesterday() string {
	return formatTime(time.Now().UTC().AddDate(0, 0, -1))
}
func formatTime(tm time.Time) string {
	year, month, date := tm.Date()
	return time.Date(year, month, date, 0, 0, 0, 0, time.UTC).Format("2006/01/02 15:04:05 -0700")
}