testing/filebeat: upgrade to 5.1.2 and add service script

* Upgrade to latest 5.1.2 release
* Added service script for filebeat
* Cleanup/update APKBUILD
This commit is contained in:
Gennady Feldman 2017-01-02 21:45:06 +00:00 committed by Timo Teräs
parent ef1fbe5fbe
commit e67aea1521
4 changed files with 195 additions and 18 deletions

View File

@ -1,7 +1,7 @@
# Contributor: Ramanathan Sivagurunathan <ramzthecoder@gmail.com>
# Maintainer: Ramanathan Sivagurunathan <ramzthecoder@gmail.com>
pkgname=filebeat
pkgver=1.3.1
pkgver=5.1.2
pkgrel=0
pkgdesc="Beats - Lightweight shippers for Elasticsearch & Logstash"
pkgusers="root"
@ -9,32 +9,46 @@ url="https://www.elastic.co/products/beats"
arch="all"
license="ASL 2.0"
depends=""
depends_dev="go bash"
makedepends="$depends_dev"
makedepends="go"
install=""
subpackages=""
source="beats-${pkgver}.tar.gz::https://github.com/elastic/beats/archive/v$pkgver.tar.gz"
builddir="$srcdir/github.com/elastic/beats/filebeat"
source="beats-${pkgver}.tar.gz::https://github.com/elastic/beats/archive/v$pkgver.tar.gz
filebeat.initd
filebeat.confd
filebeat.yml
"
builddir="$srcdir/src/github.com/elastic/beats/$pkgname"
prepare() {
mkdir -p "$srcdir/github.com/elastic/"
mv "beats-${pkgver}" "$srcdir/github.com/elastic/beats"
mkdir -p "$srcdir/src/github.com/elastic/"
mv "$srcdir/beats-${pkgver}" "$srcdir/src/github.com/elastic/beats" || return 1
default_prepare
}
build() {
export GOPATH="$srcdir/../"
cd "$builddir"
make || return 1
cd "$builddir"
GOPATH="$srcdir" go build -v || return 1
}
package() {
mkdir -p "$pkgdir"
cd "$pkgdir"
install -Dm644 "$builddir"/etc/filebeat.template.json ./etc/$pkgname/filebeat.template.json
install -Dm644 "$builddir/etc/filebeat.yml" ./etc/$pkgname/filebeat.yml
install -Dm755 "$builddir/filebeat" ./usr/bin/filebeat
cd "$builddir"
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname || return 1
install -Dm644 "$builddir"/filebeat.template.json "$pkgdir/etc/$pkgname/filebeat.template.json" || return 1
install -Dm644 "$builddir"/filebeat.template-es2x.json "$pkgdir/etc/$pkgname/filebeat.template-es2x.json" || return 1
install -Dm644 "$srcdir/filebeat.yml" "$pkgdir/etc/$pkgname/filebeat.yml" || return 1
install -Dm755 "$builddir/filebeat" "$pkgdir/usr/bin/filebeat" || return 1
}
md5sums="349e289a7f39e8e10a64204fcb014e09 beats-1.3.1.tar.gz"
sha256sums="1d8e41b42a0b2dd59403795ff07cbfd8a9a76477731c38122aa9242b47b054e0 beats-1.3.1.tar.gz"
sha512sums="60f6d4ae93bb01e74311d7ccc3d367707f888f58898b89a0ea7512c96b6e1369edf7dc2afe3615df97e8c311629d9fc1e9fc2f1abe8edcbb5bc5bcf47c82107c beats-1.3.1.tar.gz"
md5sums="89ba4e5eca07454f5d83debbf4ff48d6 beats-5.1.2.tar.gz
57712ca4cea6a05e852511c27c8d85bd filebeat.initd
a65117f047e595e1f544d384a8fb2458 filebeat.confd
4ef2573383a066ba1070482016527cc4 filebeat.yml"
sha256sums="7cd554f8be6b02290ebbc17c9820acde3dc59108672ced7a0cf5486faa3e23ce beats-5.1.2.tar.gz
eaa21f4937139c86b34489867590f006220757b3af8d7ef0fffafce937640930 filebeat.initd
ea4f0b98a695d7044d62c97e03eb8310fc30b52917e0dde01f3567cc42858544 filebeat.confd
d406ef8860873cea1aef5546147f8ccadeb3796c0c81a0e62e4d91bc50a379e5 filebeat.yml"
sha512sums="f5ade54c3a2471680067fc5f6861ddcc052177c473f40d2135ba281e63172a4ba386368f77e5e4ba77b60c88ee20e5cd0095705aa3ed6e2588fda034de6b116f beats-5.1.2.tar.gz
ea49bc4da6f66e01ad2b563d9179a992c6dc07410c8ad107f7c5ce65426ee6010871b1cbf9634310765aa5d2da0261eb2aee2c93bbe11de5f0d6d7e903402d15 filebeat.initd
25321037cd036f05186c21c73889e9b2716bbfa30597edcf90a110fca761396f30df20142e025d6175ae6ed743f08c574fa54e8df8577c1bf416bce17bec7170 filebeat.confd
b0d5fa1d37041a4f1383451107abcdab1ce15ed537f702f55756f59c2110445dcddaf7c58f2a0561e18b83e3cab72fceb9d931bae9267f1acd9d35135555d6f7 filebeat.yml"

View File

@ -0,0 +1,2 @@
# FileBeat startup
filebeat_opts="-c /etc/filebeat/filebeat.yml -e"

View File

@ -0,0 +1,42 @@
#!/sbin/openrc-run
FILEBEAT_LOG_FILE="/var/log/${SVCNAME}.log"
name=filebeat
description="Beats - Lightweight shippers for Elasticsearch & Logstash"
description_checkconfig="Verify configuration file"
daemon=/usr/bin/$name
extra_commands="checkconfig"
start_pre() {
checkpath -f -m 0644 "$FILEBEAT_LOG_FILE"
}
depend() {
need net
after firewall
}
checkconfig() {
filebeat -configtest -c /etc/filebeat/filebeat.yml
}
start() {
checkconfig || return 1
ebegin "Starting ${name}"
start-stop-daemon --start --quiet \
-m --pidfile /var/run/${name}.pid \
-b --stdout $FILEBEAT_LOG_FILE --stderr $FILEBEAT_LOG_FILE \
--exec ${daemon} -- ${filebeat_opts}
eend $?
}
stop() {
ebegin "Stopping ${name}"
start-stop-daemon --stop --quiet \
--pidfile /var/run/${name}.pid \
--exec ${daemon}
eend $?
}

View File

@ -0,0 +1,119 @@
###################### Filebeat Configuration Example #########################
# This file is an example configuration file highlighting only the most common
# options. The filebeat.full.yml file from the same directory contains all the
# supported options with more comments. You can use it as a reference.
#
# You can find the full configuration reference here:
# https://www.elastic.co/guide/en/beats/filebeat/index.html
path.config: /etc/filebeat
path.data: /var/lib/filebeat
path.logs: /var/log/filebeat
#=========================== Filebeat prospectors =============================
filebeat.prospectors:
# Each - is a prospector. Most options can be set at the prospector level, so
# you can use different prospectors for various configurations.
# Below are the prospector specific configurations.
- input_type: log
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /var/log/*.log
#- c:\programdata\elasticsearch\logs\*
# Exclude lines. A list of regular expressions to match. It drops the lines that are
# matching any regular expression from the list.
#exclude_lines: ["^DBG"]
# Include lines. A list of regular expressions to match. It exports the lines that are
# matching any regular expression from the list.
#include_lines: ["^ERR", "^WARN"]
# Exclude files. A list of regular expressions to match. Filebeat drops the files that
# are matching any regular expression from the list. By default, no files are dropped.
#exclude_files: [".gz$"]
# Optional additional fields. These field can be freely picked
# to add additional information to the crawled log files for filtering
#fields:
# level: debug
# review: 1
### Multiline options
# Mutiline can be used for log messages spanning multiple lines. This is common
# for Java Stack Traces or C-Line Continuation
# The regexp Pattern that has to be matched. The example pattern matches all lines starting with [
#multiline.pattern: ^\[
# Defines if the pattern set under pattern should be negated or not. Default is false.
#multiline.negate: false
# Match can be set to "after" or "before". It is used to define if lines should be append to a pattern
# that was (not) matched before or after or as long as a pattern is not matched based on negate.
# Note: After is the equivalent to previous and before is the equivalent to to next in Logstash
#multiline.match: after
#================================ General =====================================
# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
#name:
# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]
# Optional fields that you can specify to add additional information to the
# output.
#fields:
# env: staging
#================================ Outputs =====================================
# Configure what outputs to use when sending the data collected by the beat.
# Multiple outputs may be used.
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]
# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"
#----------------------------- Logstash output --------------------------------
#output.logstash:
# The Logstash hosts
#hosts: ["localhost:5044"]
# Optional SSL. By default is off.
# List of root certificates for HTTPS server verifications
#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
# Certificate for SSL client authentication
#ssl.certificate: "/etc/pki/client/cert.pem"
# Client Certificate Key
#ssl.key: "/etc/pki/client/cert.key"
#================================ Logging =====================================
# Sets log level. The default log level is info.
# Available log levels are: critical, error, warning, info, debug
#logging.level: debug
# At debug level, you can selectively enable logging only for some components.
# To enable all selectors use ["*"]. Examples of other selectors are "beat",
# "publish", "service".
#logging.selectors: ["*"]