Source
yaml
id: export_audit_logs_csv
namespace: company.team
tasks:
- id: ship_audit_logs
type: io.kestra.plugin.ee.core.log.AuditLogShipper
lookbackPeriod: P1D
logExporters:
- id: file
type: io.kestra.plugin.ee.core.log.FileLogExporter
- id: convert_to_csv
type: io.kestra.plugin.serdes.csv.IonToCsv
from: "{{ outputs.ship_audit_logs.outputs.file.uris | first }}"
- id: send_email
type: io.kestra.plugin.notifications.mail.MailSend
from: hello@kestra.io
to: hello@kestra.io
username: "{{ secret('EMAIL_USERNAME') }}"
password: "{{ secret('EMAIL_PASSWORD') }}"
host: mail.privateemail.com
port: 465 # or 587
subject: "Weekly Kestra Audit Logs CSV Export"
htmlTextContent: "Weekly Kestra Audit Logs CSV Export"
attachments:
- name: audit_logs.csv
uri: "{{ outputs.convert_to_csv.uri }}"
contentType: text/csv
triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: 0 10 * * 5
About this blueprint
Kestra
This flow shows how to export Kestra audit logs as a CSV file and send out via Email.
The flow is triggered weekly every Friday at 10 AM UTC. You can customize the trigger by changing the cron expression, timezone and more. For more information about cron expressions, visit the following documentation.
More Related Blueprints