-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Update master See merge request back-end/elastalert!28
- Loading branch information
Showing
14 changed files
with
148 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM alpine:latest as py-ea | ||
ARG ELASTALERT_VERSION=v0.1.33 | ||
ARG ELASTALERT_VERSION=v0.1.36 | ||
ENV ELASTALERT_VERSION=${ELASTALERT_VERSION} | ||
# URL from which to download Elastalert. | ||
ARG ELASTALERT_URL=https://github.com/Yelp/elastalert/archive/$ELASTALERT_VERSION.zip | ||
|
@@ -26,12 +26,10 @@ RUN sed -i 's/jira>=1.0.10/jira>=1.0.10,<1.0.15/g' setup.py && \ | |
|
||
FROM node:alpine | ||
LABEL maintainer="BitSensor <[email protected]>" | ||
# Set this environment variable to True to set timezone on container start. | ||
ENV SET_CONTAINER_TIMEZONE False | ||
# Default container timezone as found under the directory /usr/share/zoneinfo/. | ||
ENV CONTAINER_TIMEZONE Etc/UTC | ||
# Set timezone for this container | ||
ENV TZ Etc/UTC | ||
|
||
RUN apk add --update --no-cache curl tzdata python2 make | ||
RUN apk add --update --no-cache curl tzdata python2 make libmagic | ||
|
||
COPY --from=py-ea /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages | ||
COPY --from=py-ea /opt/elastalert /opt/elastalert | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import elasticsearch from 'elasticsearch'; | ||
import config from './config'; | ||
|
||
export function getClient() { | ||
var client = new elasticsearch.Client({ | ||
hosts: [ `http://${config.get('es_host')}:${config.get('es_port')}`] | ||
}); | ||
return client; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getClient } from '../../common/elasticsearch_client'; | ||
|
||
export default function metadataHandler(request, response) { | ||
/** | ||
* @type {ElastalertServer} | ||
*/ | ||
|
||
var client = getClient(); | ||
|
||
client.indices.getMapping({ | ||
index: request.params.index | ||
}).then(function(resp) { | ||
response.send(resp); | ||
}, function(err) { | ||
response.send({ | ||
error: err | ||
}); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import config from '../../common/config'; | ||
import { getClient } from '../../common/elasticsearch_client'; | ||
|
||
|
||
function getQueryString(request) { | ||
if (request.params.type === 'elastalert_error') { | ||
return '*:*'; | ||
} | ||
else { | ||
return `rule_name:${request.query.rule_name || '*'}`; | ||
} | ||
} | ||
|
||
export default function metadataHandler(request, response) { | ||
/** | ||
* @type {ElastalertServer} | ||
*/ | ||
var client = getClient(); | ||
|
||
client.search({ | ||
index: config.get('writeback_index'), | ||
type: request.params.type, | ||
body: { | ||
from : request.query.from || 0, | ||
size : request.query.size || 100, | ||
query: { | ||
query_string: { | ||
query: getQueryString(request) | ||
} | ||
}, | ||
sort: [{ '@timestamp': { order: 'desc' } }] | ||
} | ||
}).then(function(resp) { | ||
resp.hits.hits = resp.hits.hits.map(h => h._source); | ||
response.send(resp.hits); | ||
}, function(err) { | ||
response.send({ | ||
error: err | ||
}); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters