Added plugin (only for contrib right now) installation script

Updated docs.
This commit is contained in:
Aaron Mildenstein 2014-02-12 18:20:41 -06:00
parent 004a939b8f
commit 3f7a83f351
2 changed files with 72 additions and 24 deletions

61
bin/plugin Executable file
View file

@ -0,0 +1,61 @@
#!/bin/sh
# Install contrib plugins.
#
# Usage:
# bin/plugin install contrib
#
# Figure out if we're using wget or curl
basedir=$(cd `dirname $0`/..; pwd)
. ${basedir}/bin/logstash.lib.sh
WGET=$(which wget 2>/dev/null)
CURL=$(which curl 2>/dev/null)
URLSTUB="http://download.elasticsearch.org/logstash/logstash/"
if [ "x$WGET" != "x" ]; then
DOWNLOAD_COMMAND="wget -q --no-check-certificate -O"
elif [ "x$CURL" != "x" ]; then
DOWNLOAD_COMMAND="curl -s -L -k -o"
else
echo "wget or curl are required."
exit 1
fi
if [ -f "$basedir/lib/logstash/version.rb" ] ; then
VERSION=$(cat "$basedir/lib/logstash/version.rb" | grep LOGSTASH_VERSION | awk -F\" '{print $2}')
else
echo "ERROR: Cannot determine Logstash version. Exiting."
exit 1
fi
# Placeholder for now, if other installs ever become available.
if [ "x$2" != "xcontrib" ]; then
echo "Can only install contrib at this time... Exiting."
exit 1
fi
TARGETDIR="$basedir/vendor/logstash"
mkdir -p $TARGETDIR
SUFFIX=".tar.gz"
FILEPATH="logstash-contrib-${VERSION}"
FILENAME=${FILEPATH}${SUFFIX}
TARGET="${TARGETDIR}/${FILENAME}"
case $1 in
install)
exec $DOWNLOAD_COMMAND ${TARGET} ${URLSTUB}${FILENAME}
if [ ! -f "${TARGET}" ]; then
echo "ERROR: Unable to download ${URLSTUB}${FILENAME}"
echo "Exiting."
exit 1
fi
gzip -dc ${TARGETDIR}${FILENAME} | tar -xC $TARGETDIR
cp -R ${TARGETDIR}/$FILEPATH/* . ;; # Copy contents to local directory, adding on top of existing install
*)
echo "Usage: bin/plugin install contrib"
exit 0
;;
esac

View file

@ -1,5 +1,5 @@
---
title: Logstash Core and Contrib - logstash
title: Logstash Core and Contrib
layout: content_right
---
@ -11,7 +11,15 @@ Contrib plugins reside in a [separate github project](https://github.com/elastic
# Packaging
At present, the contrib modules are available as a tarball.
# Installation
# Automated Installation
The `bin/plugin` script will handle the installation for you:
```
cd /path/to/logstash
bin/plugin install contrib
```
# Manual Installation (if you're behind a firewall, etc.)
The tarball build defaults to extract on top of an existing Logstash tarball installation.
For example, if I've extracted `logstash-1.4.0.tar.gz` into `/path`, e.g.
@ -34,25 +42,4 @@ cd /path
tar zxf ~/logstash-contrib-1.4.0.tar.gz
```
This will install the contrib plugins in the same directory as the core install.
# Building contrib
Building your own contrib plugin collection tarball is important if you wish to
add your own custom plugins and then distribute those to your Logstash installations.
* Clone the repository, e.g.
```git clone https://github.com/elasticsearch/logstash-contrib.git```
* Checkout the correct version (e.g. v1.4.0) to match your core Logstash installation, e.g.
```git checkout v1.4.0```
* (If you have code or changes to add/remove, make them at this point, if not proceed to
the next step.)
* Build the tarball package:
```make tarball```
* The resulting `logstash-contrib-${VERSION}.tar.gz` will be in the `build` directory
This will install the contrib plugins in the same directory as the core install.