0
    
          
  
  
    
            Exporting 24 Hour Events List
Forum / Questions & Answers
Hi Is there any way we can generate a CSV and send it out of Canary for events every 24H?
Thanks
2 replies
- 
  One way to generate a CSV and send it out of Canary for events every 24 hours is to configure an SQLite database and then query the database to retrieve the required events. Here is a step-by-step approach: - Configure an SQLite Database: - Set up an SQLite database to store the events data from Canary.
 
- Insert Data into SQLite Database: - Ensure that your Canary system is configured to insert the event data into the SQLite database.
 
- Query the SQLite Database: - Use a SQL query to select the events that occurred within the last 24 hours. Here is an example of a query that retrieves all events from the last 24 hours:
- SELECT * FROM events WHERE timestamp >= datetime('now', '-1 day')
 
- 
  - In this query: 
    - eventsis the table name where your event data is stored.
- timestampis the column that stores the event time.
- datetime('now', '-1 day')is an SQLite function that returns the date and time 24 hours ago from the current time.
 
 
- In this query: 
    
- Export Query Results to CSV: - Use a script or tool to execute the above query and export the results to a CSV file.
 
- Automate the Process: - Schedule this process to run every 24 hours using a task scheduler or cron job, ensuring that a new CSV file is generated and sent out daily.