Skip to content

Commit 8969646

Browse files
committed
Add status code
1 parent 26cac18 commit 8969646

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

helm/templates/_helpers_config_logstream.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ createStream() {
77
echo;
88
echo \"Creating the log stream $STREAM\";
99

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");
10+
response=$(curl -sS --header 'Content-Type: application/json' -u "$P_USERNAME":"$P_PASSWORD" -w 'HTTPSTATUS:%{http_code}' --location --request PUT "http://{{ include "parseable.fullname" . }}.{{ .Release.Namespace }}:{{ $.Values.parseable.service.port }}/api/v1/logstream/$STREAM");
1111

12-
http_code=$(tail -n1 <<< "$response")
13-
content=$(sed '$ d' <<< "$response")
14-
echo \"status code: $http_code\"
15-
echo \"response message: $content\"
12+
HTTP_BODY=$(echo $response | sed -e 's/HTTPSTATUS\:.*//g')
13+
HTTP_STATUS=$(echo $response | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
14+
15+
echo \"API response:\"
16+
echo \"HTTP status code: $HTTP_STATUS\"
17+
echo \"HTTP response message: $HTTP_BODY\"
1618
}
1719

1820
setRetention() {
@@ -23,12 +25,14 @@ setRetention() {
2325
echo;
2426
echo \"Setting the retention for $STREAM\";
2527

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\"}]");
28+
response=$(curl -sS --header 'Content-Type: application/json' -u "$P_USERNAME":"$P_PASSWORD" -w 'HTTPSTATUS:%{http_code}' --location --request PUT "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\"}]");
29+
30+
HTTP_BODY=$(echo $response | sed -e 's/HTTPSTATUS\:.*//g')
31+
HTTP_STATUS=$(echo $response | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
2732

28-
http_code=$(tail -n1 <<< "$response")
29-
content=$(sed '$ d' <<< "$response")
30-
echo \"status code: $http_code\"
31-
echo \"response message: $content\"
33+
echo \"API response:\"
34+
echo \"HTTP status code: $HTTP_STATUS\"
35+
echo \"HTTP response message: $HTTP_BODY\"
3236
}
3337

3438
{{ if .Values.parseable.logstream }}

helm/values.yaml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
parseable:
22
image:
33
repository: parseable/parseable
4-
tag: v0.4.1
4+
tag: v0.4.3
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)
8-
local: true
9-
env:
10-
RUST_LOG: error
11-
## Use this to create and configure Parseable logstreams
12-
logstream:
13-
- name: "vectordemo"
14-
retention:
15-
action: "delete"
16-
duration: "30d"
17-
- name: "fluentbitdemo"
18-
retention:
19-
action: "delete"
20-
duration: "30d"
8+
local: false
9+
# env:
10+
# RUST_LOG: error
11+
# ## Enable to create and configure logstreams
12+
# logstream:
13+
# - name: "vectordemo"
14+
# retention:
15+
# action: "delete"
16+
# duration: "30d"
17+
# - name: "fluentbitdemo"
18+
# retention:
19+
# action: "delete"
20+
# duration: "30d"
2121
## enable/disable persistence using PVC for the Data and Staging directories
2222
## Note that Data directory is needed only for local mode
2323
persistence:
@@ -31,7 +31,6 @@ parseable:
3131
storageClass: ""
3232
accessMode: ReadWriteOnce
3333
size: 1Gi
34-
## Use
3534
localModeSecret:
3635
- type: env
3736
name: parseable-env-secret
@@ -73,11 +72,11 @@ parseable:
7372
port: 80
7473
resources:
7574
limits:
76-
cpu: 100m
77-
memory: 250Mi
75+
cpu: 500m
76+
memory: 4Gi
7877
requests:
79-
cpu: 100m
80-
memory: 250Mi
78+
cpu: 250m
79+
memory: 1Gi
8180
securityContext:
8281
allowPrivilegeEscalation: false
8382
podAnnotations: {}

0 commit comments

Comments
 (0)