Skip to content

Commit

Permalink
Added plugin (only for contrib right now) installation script
Browse files Browse the repository at this point in the history
Updated docs.
  • Loading branch information
untergeek committed Feb 13, 2014
1 parent 004a939 commit 3f7a83f
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 24 deletions.
61 changes: 61 additions & 0 deletions bin/plugin
@@ -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
35 changes: 11 additions & 24 deletions docs/core-vs-contrib.md
@@ -1,5 +1,5 @@
---
title: Logstash Core and Contrib - logstash
title: Logstash Core and Contrib
layout: content_right
---

Expand All @@ -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.

Expand All @@ -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.

0 comments on commit 3f7a83f

Please sign in to comment.