Fluent-logging: Update kubernetes plugin test

This updates the kubernetes plugin test for fluent-logging to
search across all indices instead of the default logstash-* index
to account for custom indexes created for the events tagged with
the kubernetes plugin.

This also makes the search pattern for the tag more flexible to
account for any arbitrary number of prefixes and/or suffixes
added to the 'kube' tag as a result of any processing done in
fluentd.

Change-Id: Ib1a431cc8b2ca2cc143a8c8337b87f54f56d1029
This commit is contained in:
Steve Wilkerson 2018-09-19 08:20:18 -05:00
parent a98b14d541
commit 3f952be4c1

View File

@ -36,7 +36,7 @@ function check_logstash_index () {
# prefix via the fluent-kubernetes plugin
function check_kubernetes_tag () {
total_hits=$(curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \
-XGET "${ELASTICSEARCH_ENDPOINT}/logstash-*/_search?q=tag:kube.*" -H 'Content-Type: application/json' \
-XGET "${ELASTICSEARCH_ENDPOINT}/_search?q=tag:**kube.**" -H 'Content-Type: application/json' \
| python -c "import sys, json; print json.load(sys.stdin)['hits']['total']")
if [ "$total_hits" -gt 0 ]; then
echo "PASS: Successful hits on logstash-* index, provided by fluentd!"