Skip to content

Commit b0b01c0

Browse files
author
Martijn Rondeel
committed
Merge branch 'develop' into 'master'
Bump master to 0.0.10 See merge request back-end/elastalert!16
2 parents 338e90f + f65a5f5 commit b0b01c0

25 files changed

+450
-110
lines changed

.dockerignore

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
.editorconfig
2-
.gitlab-ci.yml
3-
.gitignore
4-
*.iml
5-
.idea/
6-
.git/
7-
node_modules/
8-
lib/
1+
*
2+
!index.js
3+
!package-lock.json
4+
!package.json
5+
!.babelrc
6+
!src/
7+
!scripts/
8+
!elastalert_modules/
9+
!rule_templates/
10+
!config/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ jspm_packages
7373
lib/
7474
*.pyc
7575
config/config.json
76+
package-lock.json

.gitlab-ci.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
stages:
2323
- build
2424
- test
25-
- deploy
2625
- mirror
26+
- deploy
2727

2828
cache:
2929
key: elastalert
@@ -45,11 +45,18 @@ test:
4545
- npm install --quiet
4646
- npm test
4747

48-
lint:
49-
<<: *node-test
48+
mirror:github:
49+
stage: mirror
5050
script:
51-
- npm install --quiet
52-
- ./node_modules/.bin/eslint .
51+
- git clone --mirror https://git.bitsensor.io/back-end/elastalert.git mirror-github
52+
- cd mirror-github
53+
- git remote add github https://$MIRROR_GITHUB_USER:$MIRROR_GITHUB_PASSWORD@$MIRROR_GITHUB_URL
54+
- git push -u github -q --mirror
55+
- rm -rf mirror-github
56+
when: always
57+
only:
58+
- tags
59+
- develop
5360

5461
deploy:npm:
5562
image: node:slim
@@ -64,8 +71,9 @@ deploy:npm:
6471
deploy:docker:
6572
stage: deploy
6673
script:
74+
- sh scripts/replace_templates.sh ${CI_JOB_TOKEN}
6775
- docker info
68-
- docker login -u $BITSENSOR_USERNAME -p $BITSENSOR_PASSWORD artifacts.bitsensor.io:1443
76+
- echo $BITSENSOR_PASSWORD | docker login -u $BITSENSOR_USERNAME --password-stdin artifacts.bitsensor.io:1443
6977
- docker build -t elastalert .
7078
- docker tag elastalert artifacts.bitsensor.io:1443/elastalert:latest
7179
- docker tag elastalert artifacts.bitsensor.io:1443/elastalert:$(git describe --abbrev=0)
@@ -79,8 +87,9 @@ deploy:docker:
7987
deploy:docker:snapshot:
8088
stage: deploy
8189
script:
90+
- sh scripts/replace_templates.sh ${CI_JOB_TOKEN}
8291
- docker info
83-
- docker login -u $BITSENSOR_USERNAME -p $BITSENSOR_PASSWORD artifacts.bitsensor.io:1443
92+
- echo $BITSENSOR_PASSWORD | docker login -u $BITSENSOR_USERNAME --password-stdin artifacts.bitsensor.io:1443
8493
- docker build -t elastalert .
8594
- docker tag elastalert artifacts.bitsensor.io:1443/elastalert:snapshot
8695
- docker push artifacts.bitsensor.io:1443/elastalert:snapshot
@@ -89,14 +98,30 @@ deploy:docker:snapshot:
8998
tags:
9099
- docker
91100

92-
mirror:github:
93-
stage: mirror
101+
deploy:docker-hub:
102+
stage: deploy
94103
script:
95-
- git clone --mirror https://git.bitsensor.io/back-end/elastalert.git mirror-github
96-
- cd mirror-github
97-
- git remote add github https://$MIRROR_GITHUB_USER:$MIRROR_GITHUB_PASSWORD@$MIRROR_GITHUB_URL
98-
- git push -u github -q --mirror
99-
when: always
104+
- docker info
105+
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
106+
- docker build -t elastalert .
107+
- docker tag elastalert bitsensor/elastalert:latest
108+
- docker tag elastalert bitsensor/elastalert:$(git describe --abbrev=0)
109+
- docker push bitsensor/elastalert:latest
110+
- docker push bitsensor/elastalert:$(git describe --abbrev=0)
100111
only:
101112
- tags
113+
tags:
114+
- docker
115+
116+
deploy:docker-hub:snapshot:
117+
stage: deploy
118+
script:
119+
- docker info
120+
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
121+
- docker build -t elastalert .
122+
- docker tag elastalert bitsensor/elastalert:snapshot
123+
- docker push bitsensor/elastalert:snapshot
124+
only:
102125
- develop
126+
tags:
127+
- docker

.node-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.9.0

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cd elastalert
2525

2626
Then follow the default installation steps, so:
2727

28-
1. Run `nvm install "$(cat .node-version)"` to install & use the required NodeJS version.
28+
1. Run `nvm install "$(cat .nvmrc)"` to install & use the required NodeJS version.
2929
2. Run `npm install` to install all the dependencies.
3030
3. Look at the `Config` section in [REAMDE.md](../README.md#config) to setup the path to your ElastAlert instance.
3131

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ FROM ivankrizsan/elastalert AS py-ea
33
# ENV ELASTALERT_URL https://github.com/bitsensor/yelp-elastalert/archive/master.zip
44

55
FROM node:alpine
6-
MAINTAINER BitSensor <[email protected]>
6+
LABEL maintainer="[email protected]"
77
EXPOSE 3030
88

9-
RUN apk update && apk upgrade && apk add python2
9+
RUN apk update && apk add --no-cache python2 curl
1010

1111
COPY --from=py-ea /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages
1212
COPY --from=py-ea /opt/elastalert /opt/elastalert

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The 3-clause BSD license (Modified)
22
===================================
33

4-
Copyright © 2016, BitSensor B.V.
4+
Copyright © 2018, BitSensor B.V.
55

66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,57 @@
11
# Elastalert Server
22
**A server that runs [ElastAlert](https://github.com/Yelp/elastalert) and exposes REST API's for manipulating rules and alerts. It works great in combination with our [ElastAlert Kibana plugin](https://github.com/bitsensor/elastalert-kibana-plugin).**
33

4-
## Requirements
5-
- Docker
4+
![img](https://www.bitsensor.io/assets/img/screenshots/template.gif)
65

7-
## Docker installation
8-
First, build the container locally:
6+
## Installing Kibana plugin
7+
Kibana 4
8+
```bash
9+
./bin/kibana plugin -i elastalert -u https://git.bitsensor.io/front-end/elastalert-kibana-plugin/builds/artifacts/master/raw/build/elastalert-latest.zip?job=build
10+
```
11+
12+
Kibana 5
13+
```bash
14+
./bin/kibana-plugin install https://git.bitsensor.io/front-end/elastalert-kibana-plugin/builds/artifacts/kibana5/raw/artifact/elastalert-`pwd | grep -Po '(?<=kibana-)[^-]*'`-latest.zip?job=build
15+
```
16+
17+
Kibana 5 (if you have renamed the `kibana-5.x.x` folder
918
```bash
10-
docker build . -t elastalert
19+
./bin/kibana-plugin install https://git.bitsensor.io/front-end/elastalert-kibana-plugin/builds/artifacts/kibana5/raw/artifact/elastalert-5.x.x-latest.zip?job=build
1120
```
12-
The default configuration uses localhost as ES host.
1321

14-
_Bash_
22+
Append to the `config/kibana.yml` file the host of ElastAlert server, if it is different than localhost. Typically the case if you are running on macOS.
23+
```
24+
elastalert.serverHost: docker.for.mac.localhost
25+
```
26+
27+
## Docker installation
28+
The default configuration uses localhost as ES host. You will want to mount the volumes for configuration and rule files to keep them after container updates. In order to do that conviniently, please do a `git clone https://github.com/bitsensor/elastalert.git; cd elastalert`
29+
30+
### Bash
1531
```bash
1632
docker run -d -p 3030:3030 \
1733
-v `pwd`/config/elastalert.yaml:/opt/elastalert/config.yaml \
1834
-v `pwd`/config/config.json:/opt/elastalert-server/config/config.json \
1935
-v `pwd`/rules:/opt/elastalert/rules \
2036
-v `pwd`/rule_templates:/opt/elastalert/rule_templates \
21-
-v `pwd`/elastalert_modules:/opt/elastalert/elastalert_modules \
2237
--net="host" \
23-
--name elastalert elastalert:latest
38+
--name elastalert bitsensor/elastalert:latest
2439
```
2540

26-
_Fish_
41+
### Fish
2742
```bash
2843
docker run -d -p 3030:3030 \
2944
-v (pwd)/config/elastalert.yaml:/opt/elastalert/config.yaml \
3045
-v (pwd)/config/config.json:/opt/elastalert-server/config/config.json \
3146
-v (pwd)/rules:/opt/elastalert/rules \
3247
-v (pwd)/rule_templates:/opt/elastalert/rule_templates \
33-
-v (pwd)/elastalert_modules:/opt/elastalert/elastalert_modules \
3448
--net="host" \
35-
--name elastalert elastalert:latest
49+
--name elastalert bitsensor/elastalert:latest
3650
```
3751
### Configuration
3852
#### ElastAlert parameters
3953
ElastAlert supports additional arguments, that can be passed in the `config.json` file. An example is given in `config/config-historic-data-example.json`.
4054

41-
42-
4355
## Installation using npm and manual ElastAlert setup
4456

4557
### Requirements
@@ -52,7 +64,7 @@ ElastAlert supports additional arguments, that can be passed in the `config.json
5264
git clone https://github.com/bitsensor/elastalert.git elastalert
5365
cd elastalert
5466
```
55-
2. Run `nvm install "$(cat .node-version)"` to install & use the required NodeJS version.
67+
2. Run `nvm install "$(cat .nvmrc)"` to install & use the required NodeJS version.
5668
3. Run `npm install` to install all the dependencies.
5769
4. Look at the `Config` section to setup the path to your ElastAlert instance.
5870

@@ -212,5 +224,5 @@ This project is [BSD Licensed](../LICENSE.md) with some modifications. Note that
212224
We [(BitSensor)](https://www.bitsensor.io) do not have any rights over the original [ElastAlert](https://github.com/Yelp/elastalert) project from [Yelp](https://www.yelp.com/). We do not own any trademarks or copyright to the name "ElastAlert" (ElastAlert, however, does because of their Apache 2 license). We do own copyright over the source code of this project, as stated in our BSD license, which means the copyright notice below and as stated in the BSD license should be included in (merged / changed) distributions of this project. The BSD license also states that making promotional content using 'BitSensor' is prohibited. However we hereby grant permission to anyone who wants to use the phrases 'BitSensor ElastAlert Plugin', 'BitSensor Software' or 'BitSensor Alerting' in promotional content. Phrases like 'We use BitSensor' or 'We use BitSensor security' when only using our ElastAlert Server are forbidden.
213225

214226
## Copyright
215-
Copyright © 2016, BitSensor B.V.
227+
Copyright © 2018, BitSensor B.V.
216228
All rights reserved.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
from elastalert.enhancements import BaseEnhancement
22
from util import convert_array_to_object
3-
from util import parse_detections
3+
from util import parse_array
44

5-
# For easier access to nested values in an array , this merges all items in array
5+
# For easier access to nested values in an array , this merges all items in array
66
# within
77
class AlertTextEnhancement(BaseEnhancement):
88
# The enhancement is run against every match
99
# The match is passed to the process function where it can be modified in any way
1010
# ElastAlert will do this for each enhancement linked to a rule
1111
def process(self, match):
12-
parsed_match = parse_detections(match)
12+
parsed_match = parse_array(match, 'detections')
13+
match.update(parsed_match)
14+
parsed_match = parse_array(match, 'errors')
1315
match.update(parsed_match)

0 commit comments

Comments
 (0)