Closed hamiltont closed 10 years ago
@hamiltont, you should be able to safely pull the following into your conditional logic:
# Use the LOGSTASH_CONFIG_URL env var to download and use your
# logstash.conf file.
LOGSTASH_CONFIG_URL=${LOGSTASH_CONFIG_URL:-}
https://github.com/hamiltont/docker-logstash/blob/develop/bin/boot#L12
# If you don't provide a value for the LOGSTASH_CONFIG_URL env
# var, your install will default to our very basic logstash.conf file.
if [ -z "${LOGSTASH_CONFIG_URL}" ]; then
LOGSTASH_CONFIG_URL="https://gist.github.com/pblittle/8778567/raw/logstash.conf"
fi
https://github.com/hamiltont/docker-logstash/blob/develop/bin/boot#L14-L18
Also, feel free to change "${LOGSTASH_CONFIG_URL}"
to $LOGSTASH_CONFIG_URL
to match your style.
@pblittle Both of those changes already exist in this file - are you sure you viewed the full file and not just the diff of changes? Or perhaps I'm missing something
Sorry, that didn't make much sense. I meant something like this small refactor.
Given we don't care about LOGSTASH_CONFIG_URL
if /opt/logstash.conf
is already present, the lines noted above can be pulled inside of your conditional:
# Download default conf if none present
if [ ! -f $LOGSTASH_CONFIG_FILE ]; then
# Use the LOGSTASH_CONFIG_URL env var to download and use your
# logstash.conf file.
LOGSTASH_CONFIG_URL=${LOGSTASH_CONFIG_URL:-}
# If you don't provide a value for the LOGSTASH_CONFIG_URL env
# var, your install will default to our very basic logstash.conf file.
if [ -z $LOGSTASH_CONFIG_URL ]; then
LOGSTASH_CONFIG_URL="https://gist.github.com/pblittle/8778567/raw/logstash.conf"
fi
echo "Downloading default configuration file"
wget $LOGSTASH_CONFIG_URL -O $LOGSTASH_CONFIG_FILE
# This magic will replace ES_HOST and ES_PORT in your logstash.conf
# file if they exist with the IP and port dynamically generated
# by docker. Take a look at the readme for more details.
# Note: Don't use this on a file mounting using a docker
# volume, as the inode switch will cause `device or resource busy`
# Instead download your file as normal
sed -e "s/ES_HOST/${ES_PORT_9200_TCP_ADDR}/g" \
-e "s/ES_PORT/${ES_PORT_9200_TCP_PORT}/g" \
-i $LOGSTASH_CONFIG_FILE
fi
Ah ok, I've got it now. Will change it soon
LGTM. Thank you!
changing target for #16