# Auto-Delete Settings
Whenever a performance problem brews in the application, yc-360 script captures several artifacts (Garbage Collection Log, Thread Dump, Heap Substitute, top, netstat,....) from the application and transmits to yCrash server for analysis. The yCrash server analyzes these artifacts and generates reports in the dashboard. These artifacts tend to reside in the server and consume storage. When more incidents are reported, more storage space will be consumed.
Besides storage consumption, old incident reports can clutter your dashboard. Sometimes as general housekeeping you might want to delete old incident reports that are older than a certain time period.
In such circumstances, if you want to delete one or two incident reports manually, you can use the Delete report feature in the dashboard. However if you want to auto-delete several old incidents together, "auto-delete" feature will help you. In this post, let’s discuss how to leverage this feature.
# Create 'auto-delete-settings.json'
Download
auto-delete-settings.json
template file from this location (opens new window).Place this
auto-delete-settings.json
file in the yCrash Server’s upload directory.If you use remote storage, you can store the auto-delete-settings.json file in the root directory of the remote storage (AWS S3 , Google Cloud Storage).
The yCrash application checks if the file exists locally first. If found, it reads from there. Otherwise, it looks for the file in the remote storage.
Find more information about all properties of the auto-delete-settings.json
file below:
# 1. incidentRetentionPeriod
This property determines the number of days, months, and years for which you want to retain data in your storage. When you configure this property, the yCrash tool will delete data from local storage as well as remote storage if configured.
Supported formats include: day, days, month, months, year, years.
For example, if you wish to retain 7 days of data and delete the rest, set the value of incidentRetentionPeriod to "7days".
Here are a few more examples:
- "1day": Retain data for 1 day.
- "10days": Retain data for 10 days.
- "1month": Retain data for 1 month.
- "3months": Retain data for 3 months.
- "1year": Retain data for 1 year.
- "3years": Retain data for 3 years.
# 2. runJobAt
This property specifies the schedule for the delete job. By default, the job runs daily at 12:00 AM, deleting incident data from both local and remote storage if configured. Users can customize this property to schedule a delete job at the desired time.
Supported formats:
- HH:MM: Specify the exact time to run the job daily.
- Time interval: Set the job to run after specific intervals.
Examples:
- "21:30": Run the job every day at 9:30 PM.
- "120min": Run the job every 2 hours.
# 3. localTempRetentionPeriod
This property determines the retention period for data stored locally, particularly relevant when using remote storage like AWS S3 in yCrash. When the remote storage is used incident artifacts stored are in the AWS S3 bucket. However, when large artifacts (like heap dumps) are analyzed, for fast processing yCrash saves those files locally in addition to AWS S3. If you need to frequently delete data from the local disk, you can utilize the localTempRetentionPeriod property to specify how many hours, days, months, and years of data you want to retain in your local storage.
Supported formats include: hr, hrs, day, days, month, months, year, years.
For example, if you wish to retain 6 hours of data and delete the rest, set the value of localTempRetentionPeriod to "6hrs".
Here are a few more examples:
- "1hr": Retain data locally for 1 hour.
- "1day": Retain data locally for 1 day.
- "10days": Retain data locally for 10 days.
- "1month": Retain data locally for 1 month.
- "3months": Retain data locally for 3 months.
- "1year": Retain data for locally 1 year.
- "3years": Retain data for locally 3 years.
# 4. runLocalTempJobAt
This property specifies the schedule for the delete job. By default, the job runs daily at 12:00 AM, deleting incident data from both local storage. Please note that this property will work only if you configure “localTempRetentionPeriod”.
Supported formats:
- HH:MM: Specify the exact time to run the job daily.
- Time interval: Set the job to run after specific intervals.
Examples:
- "21:30": Run the job every day at 9:30 PM.
- "120min": Run the job every 2 hours.
Please note that if unsupported values are passed to the runJobAt or runLocalTempJobAt property, the delete job will be triggered at the default time, which is 12:00 AM.
# 5. m3SamplesRetentionPeriod
This property defines how long M3 data should be retained in storage. Based on the configured duration, the yCrash tool will automatically delete older M3 data from both local and remote storage (if configured).
Default behavior:
If this property is not configured, the system will default to retaining M3 data for 1 day.
Supported formats:
Specify a number followed by a time unit, such as "7days" or "2months"
Examples:
"1day"
: Retain M3 data for 1 day."7days"
: Retain M3 data for 7 days."1month"
: Retain M3 data for 1 month."6months"
: Retain M3 data for 6 months."1year"
: Retain M3 data for 1 year.
Note: This retention policy applies only to M3 data, and affects both local and remote storage cleanup processes.
# Sample Configurations
Below are examples of configuration files (auto-delete-settings.json) for different scenarios:
Example 1: Data is stored locally. Retain data for one week and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "7days",
"runJobAt": "07:30"
}
2
3
4
Example 2: Data is stored locally. Retain data for 6 months and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "6month",
"runJobAt": "07:30"
}
2
3
4
Example 3: Data is stored locally. Retain data for 1 year and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "1year",
"runJobAt": "07:30"
}
2
3
4
Example 4: Data is stored locally. Retain data for 15 days and trigger the job every 3 hours.
{
"incidentRetentionPeriod": "15days",
"runJobAt": "180min"
}
2
3
4
Example 5: Remote storage is configured as AWS S3. Retain data for one week in both remote and local storage, and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "7days",
"runJobAt": "07:30"
}
2
3
4
Example 6: Remote storage is configured as AWS S3. Retain data for 3 months in both remote and local storage, and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "3months",
"runJobAt": "07:30"
}
2
3
4
Example 7: Remote storage is configured as AWS S3. Retain data for one year in both remote and local storage, and trigger the job at 07:30 AM every day.
{
"incidentRetentionPeriod": "1year",
"runJobAt": "07:30"
}
2
3
4
Example 8: Remote storage is configured as AWS S3. Retain data for 10 days in both remote and local storage, and trigger the job every 2 hours.
{
"incidentRetentionPeriod": "10days",
"runJobAt": "120min"
}
2
3
4
Example 9: The remote storage is configured as AWS S3. Retain data for 3 months in remote storage. Retain data for 1 day in local storage. Trigger delete job every day at 11:30 PM to delete from both local and remote storage.
{
"incidentRetentionPeriod": "3months",
"localTempRetentionPeriod": "1day",
"runJobAt": "23:30"
}
2
3
4
5
Example 10: The remote storage is configured as AWS S3. Retain data for 3 months in remote storage. Retain data for 1 day in local storage. Trigger delete job every 12 hours to delete from both local and remote storage.
{
"incidentRetentionPeriod": "3months",
"localTempRetentionPeriod": "1day",
"runJobAt": "720min"
}
2
3
4
5
Example 11: The remote storage is configured as AWS S3. Retain data for 3 months in remote storage, Retain data for 1 day in local storage. Trigger a delete job every day at 7:30 PM to delete data from remote storage, Trigger a delete job every 6 hours to delete data from local storage.
{
"incidentRetentionPeriod": "3months",
"localTempRetentionPeriod": "1day",
"runJobAt": "19:30",
"runLocalTempJobAt": "360min"
}
2
3
4
5
6
Example 12: Retain M3 data for 7 days in both local and remote storage. Trigger a cleanup job daily at 9:00 AM.
{
"m3SamplesRetentionPeriod" :"7days",
"runJobAt": "09:00"
}
2
3
4
Example 13: Retain M3 data for 1 month. Trigger a cleanup job every 12 hours.
{
"m3SamplesRetentionPeriod": "1month",
"runJobAt": "720min"
}
2
3
4
Example 14: M3 retention is not explicitly configured. Run the job daily at 11:45 PM.
{
"runJobAt": "23:45"
}
2
3
In this case, by default, the yCrash application will retain M3 data for 1 day.
Example 15: The remote storage is configured in yCrash. Retain remote storage data for 6 months and retain local storage data for 3 days. Trigger a delete job every day at 10 PM to delete data from remote storage, trigger a delete job every 6 hours to delete data from local storage. and run the m3 clean up jobs at remote storage every 6 months in remote storage and run every 6 hours for local storage
{
"incidentRetentionPeriod": "6months",
"localTempRetentionPeriod": "3days",
"m3SamplesRetentionPeriod": "10days",
"runJobAt": "22:00",
"runLocalTempJobAt": "360min",
}
2
3
4
5
6
7