@@ -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
1820setRetention () {
@@ -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 }}
0 commit comments