-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[timeseries] Add index lifecycle policy to elasticsearch
- Loading branch information
Showing
6 changed files
with
168 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
openwisp_monitoring/db/backends/elasticsearch/retention_policies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# By default age is calculated from the date the index is created but if the | ||
# index has been rolled over than the rollover date is used to calculate the age | ||
|
||
default_rp_policy = { | ||
'policy': { | ||
'phases': { | ||
'hot': { | ||
'actions': { | ||
'rollover': {'max_age': '30d', 'max_size': '90G'}, | ||
'set_priority': {'priority': 100}, | ||
} | ||
}, | ||
'warm': { | ||
'min_age': '30d', | ||
'actions': { | ||
'forcemerge': {'max_num_segments': 1}, | ||
'allocate': {'number_of_replicas': 0}, | ||
'set_priority': {'priority': 50}, | ||
}, | ||
}, | ||
'cold': {'min_age': '150d', 'actions': {'freeze': {}}}, | ||
'delete': {'min_age': '335d', 'actions': {'delete': {}}}, | ||
} | ||
} | ||
} | ||
|
||
|
||
def _make_policy(max_age): | ||
return { | ||
'policy': { | ||
'phases': { | ||
'hot': { | ||
'actions': { | ||
'rollover': {'max_age': max_age}, | ||
'set_priority': {'priority': 100}, | ||
} | ||
}, | ||
'delete': {'actions': {'delete': {}}}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters