Skip to content

Commit c756b13

Browse files
committed
Add set retention call
1 parent 1712b7e commit c756b13

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

helm/templates/_helpers_config_logstream.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,35 @@ createStream() {
66
STREAM=$1
77
echo;
88
echo \"Creating the log stream $STREAM\";
9-
curl -sS --header 'Content-Type: application/json' -u "$P_USERNAME":"$P_PASSWORD" --location --request PUT "http://{{ include "parseable.fullname" . }}.{{ .Release.Namespace }}:{{ $.Values.parseable.service.port }}/api/v1/logstream/$STREAM";
9+
10+
response=$(curl -sS --header 'Content-Type: application/json' -u "$P_USERNAME":"$P_PASSWORD" -w '\n\n%{http_code}' --location --request PUT "http://{{ include "parseable.fullname" . }}.{{ .Release.Namespace }}:{{ $.Values.parseable.service.port }}/api/v1/logstream/$STREAM");
11+
12+
http_code=$(tail -n1 <<< "$response")
13+
content=$(sed '$ d' <<< "$response")
14+
echo \"status code: $http_code\"
15+
echo \"response message: $content\"
1016
}
1117

1218
setRetention() {
13-
19+
STREAM=$1
20+
ACTION=$2
21+
DURATION=$3
22+
23+
echo;
24+
echo \"Setting the retention for $STREAM\";
25+
26+
response=$(curl -sS --header 'Content-Type: application/json' -u "$P_USERNAME":"$P_PASSWORD" -w '\n\n%{http_code}' --location --request POST "http://{{ include "parseable.fullname" . }}.{{ .Release.Namespace }}:{{ $.Values.parseable.service.port }}/api/v1/logstream/$STREAM/retention" --data "[{\"description\":\"$ACTION logs after $DURATION\",\"action\":\"$ACTION\",\"duration\":\"$DURATION\"}]");
27+
28+
http_code=$(tail -n1 <<< "$response")
29+
content=$(sed '$ d' <<< "$response")
30+
echo \"status code: $http_code\"
31+
echo \"response message: $content\"
1432
}
1533

1634
{{ if .Values.parseable.logstream }}
1735
# Create the logstream
1836
{{- range .Values.parseable.logstream }}
1937
createStream {{.name}}
20-
setRetention {{.retention}}
38+
setRetention {{.name}} {{.retention.action}} {{.retention.duration}}
2139
{{- end }}
2240
{{- end }}

helm/values.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parseable:
22
image:
33
repository: parseable/parseable
4-
tag: v0.4.0
4+
tag: v0.4.1
55
pullPolicy: Always
66
## Set to true if you want to deploy Parseable in local mode (store logs
77
## on local mount point instead of S3 bucket)
@@ -12,12 +12,10 @@ parseable:
1212
logstream:
1313
- name: "vectordemo"
1414
retention:
15-
description: "Delete logs after 30 days"
1615
action: "delete"
1716
duration: "30d"
1817
- name: "fluentbitdemo"
1918
retention:
20-
description: "Delete logs after 30 days"
2119
action: "delete"
2220
duration: "30d"
2321
## enable/disable persistence using PVC for the Data and Staging directories

0 commit comments

Comments
 (0)