mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-06-13 13:49:14 +02:00
24 lines
888 B
Bash
Executable File
24 lines
888 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
|
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
|
# https://securityonion.net/license; you may not use this file except in compliance with the
|
|
# Elastic License 2.0.
|
|
|
|
. /usr/sbin/so-common
|
|
|
|
if [[ -z "$1" ]]; then
|
|
if output=$(so-elasticsearch-query "_component_template" --retry 3 --retry-delay 1 --fail); then
|
|
jq '[.component_templates[] | .name] | sort' <<< "$output"
|
|
else
|
|
echo "Failed to retrieve component templates from Elasticsearch."
|
|
exit 1
|
|
fi
|
|
else
|
|
if output=$(so-elasticsearch-query "_component_template/$1" --retry 3 --retry-delay 1 --fail); then
|
|
jq <<< "$output"
|
|
else
|
|
echo "Failed to retrieve component template '$1' from Elasticsearch."
|
|
exit 1
|
|
fi
|
|
fi |