-
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'
Develop See merge request bitsensor/back-end/elastalert!35
- Loading branch information
Showing
15 changed files
with
186 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,5 @@ lib/ | |
*.pyc | ||
config/config.json | ||
package-lock.json | ||
|
||
.vscode |
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,4 +1,4 @@ | ||
v ?= v0.1.38 | ||
v ?= v0.1.39 | ||
|
||
all: build | ||
|
||
|
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
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,27 @@ | ||
import WebSocket from 'ws'; | ||
|
||
export var wss = null; | ||
|
||
export function listen(port) { | ||
wss = new WebSocket.Server({ port, path: '/test' }); | ||
|
||
wss.on('connection', ws => { | ||
ws.isAlive = true; | ||
ws.on('pong', () => { | ||
ws.isAlive = true; | ||
}); | ||
}); | ||
|
||
return wss; | ||
} | ||
|
||
// Keepalive in case clients lose connection during a long rule test. | ||
// If client doesn't respond in 10s this will close the socket and | ||
// therefore stop the elastalert test from continuing to run detached. | ||
setInterval(() => { | ||
wss.clients.forEach(ws => { | ||
if (ws.isAlive === false) return ws.terminate(); | ||
ws.isAlive = false; | ||
ws.ping(() => {}); | ||
}); | ||
}, 10000); |
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,18 @@ | ||
import { getClient } from '../../common/elasticsearch_client'; | ||
|
||
export default function searchHandler(request, response) { | ||
/** | ||
* @type {ElastalertServer} | ||
*/ | ||
var client = getClient(); | ||
|
||
client.search({ | ||
index: request.params.index, | ||
body: request.body | ||
}).then(function(resp) { | ||
response.send(resp); | ||
}, function(error) { | ||
response.send({ error }); | ||
}); | ||
|
||
} |
Oops, something went wrong.