22
33# Fluent Bit Setup and Management Script
44# Usage:
5- # Setup: ./ingest.sh <host[:port]> <api_key> [tenant_id]
5+ # Setup: ./ingest.sh <host[:port]> <stream> < api_key> [tenant_id]
66# Stop: ./ingest.sh stop
77# Restart: ./ingest.sh restart
88# Status: ./ingest.sh status
@@ -241,17 +241,18 @@ install_fluent_bit() {
241241# Setup function
242242setup_fluent_bit () {
243243 local INGESTOR_HOST=" $1 "
244- local API_KEY=" $2 "
245- local TENANT_ID=" ${3:- } "
244+ local STREAM_NAME=" $2 "
245+ local API_KEY=" $3 "
246+ local TENANT_ID=" ${4:- } "
246247 local TENANT_HEADER=" "
247248 local TLS_SETTING=" On"
248249 local DEFAULT_PORT=" 443"
249250 local PORT=" "
250251
251252 # Validate all fields are present
252- if [ -z " $INGESTOR_HOST " ] || [ -z " $API_KEY " ]; then
253+ if [ -z " $INGESTOR_HOST " ] || [ -z " $STREAM_NAME " ] || [ -z " $ API_KEY" ]; then
253254 print_error " Invalid setup parameters"
254- print_error " Expected format: $0 <host[:port]> <api_key> [tenant_id]"
255+ print_error " Expected format: $0 <host[:port]> <stream> < api_key> [tenant_id]"
255256 exit 1
256257 fi
257258
@@ -330,7 +331,7 @@ setup_fluent_bit() {
330331 TLS $TLS_SETTING
331332 Header X-API-Key $API_KEY
332333${TENANT_HEADER}
333- Header X-P-Stream node-metrics
334+ Header X-P-Stream $STREAM_NAME
334335 Header X-P-Log-Source otel-metrics
335336EOF
336337 chmod 600 " $CONFIG_FILE "
@@ -363,7 +364,7 @@ case "${1:-}" in
363364 echo " "
364365 echo " Usage:"
365366 echo " Setup and start:"
366- echo " $0 <host[:port]> <api_key> [tenant_id]"
367+ echo " $0 <host[:port]> <stream> < api_key> [tenant_id]"
367368 echo " "
368369 echo " Management commands:"
369370 echo " $0 start - Start Fluent Bit (if config exists)"
@@ -373,18 +374,18 @@ case "${1:-}" in
373374 echo " $0 logs - Show Fluent Bit logs"
374375 echo " "
375376 echo " Example:"
376- echo " $0 https://example.parseable.com:443 px_api_key"
377- echo " $0 http://localhost:8000 px_api_key tenant-id"
377+ echo " $0 https://example.parseable.com:443 node-metrics px_api_key"
378+ echo " $0 http://localhost:8000 node-metrics px_api_key tenant-id"
378379 ;;
379380 * )
380381 # If not a command, treat as setup parameters
381- if [ $# -lt 2 ] || [ $# -gt 3 ]; then
382- print_error " Usage: $0 <host[:port]> <api_key> [tenant_id]"
382+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
383+ print_error " Usage: $0 <host[:port]> <stream> < api_key> [tenant_id]"
383384 print_error " Or: $0 [start|stop|restart|status|logs|help]"
384385 print_error " "
385386 print_error " Example:"
386- print_error " $0 https://ec9cfee0-2fd4-45eb-8209-d7cd992c4bcc-ingestor.workspace-staging.parseable.com:443 px_api_key"
387- print_error " $0 http://localhost:8000 px_api_key tenant-id"
387+ print_error " $0 https://ec9cfee0-2fd4-45eb-8209-d7cd992c4bcc-ingestor.workspace-staging.parseable.com:443 node-metrics px_api_key"
388+ print_error " $0 http://localhost:8000 node-metrics px_api_key tenant-id"
388389 print_error " "
389390 print_error " Management commands:"
390391 print_error " $0 status - Check if running"
@@ -393,6 +394,6 @@ case "${1:-}" in
393394 print_error " $0 logs - View logs"
394395 exit 1
395396 fi
396- setup_fluent_bit " $1 " " $2 " " ${3 :- } "
397+ setup_fluent_bit " $1 " " $2 " " $3 " " ${4 :- }"
397398 ;;
398399esac
0 commit comments