logstash-output-s3
logstash-output-s3 copied to clipboard
Provide a way to refresh credentials
We're using the external credentials file (aws_credentials_file), with temporary credentials generated using Vault. The problem is that that the uploader thread is started on register, and the plugin will not allow refreshing the credentials. There should be a way to signal the plugin that the credentials were refreshed (maybe watch the file timestamp?).
Currently working around this (less than elegantly...):
#!/bin/bash -e
if [[ -z $1 ]] || [[ ${1:0:1} == '-' ]] ; then
logstash -r "$@" &
LOGSTASH_PID=$!
else
"$@" &
LOGSTASH_PID=$!
fi
echo "Started logstash as "${LOGSTASH_PID}
CREDS_HASH=$(md5sum ${AWS_CREDENTIALS_FILE})
while true; do
if [ "${CREDS_HASH}" != "$(md5sum ${AWS_CREDENTIALS_FILE})" ]; then
echo "Hash has changed, stopping logstash"
kill ${LOGSTASH_PID}
logstash "$@" &
LOGSTASH_PID=$!
echo "Started logstash as "${LOGSTASH_PID}
CREDS_HASH=$(md5sum ${AWS_CREDENTIALS_FILE})
fi
sleep 1;
done