Skip to content

Commit

Permalink
Automatic .wazuh upgrading
Browse files Browse the repository at this point in the history
  • Loading branch information
havidarou committed Dec 11, 2017
1 parent 4f06f25 commit 692721b
Show file tree
Hide file tree
Showing 3 changed files with 299 additions and 358 deletions.
2 changes: 1 addition & 1 deletion server/api/wazuh-elastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (server, options) => {
//Handlers
const fetchElastic = (req, payload) => {
return elasticRequest.callWithRequest(req, 'search', {
index: 'wazuh-alerts-*',
index: 'wazuh-alerts-3.x-*',
type: 'wazuh',
body: payload
});
Expand Down
27 changes: 0 additions & 27 deletions server/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,31 +140,6 @@ module.exports = (server, options) => {
});
};

// Setting default index pattern
const setDefaultKibanaSettings = (id) => {
server.log([blueWazuh, 'initialize', 'info'], 'Setting Kibana default values: Index pattern, time picker and metaFields...');

elasticRequest.callWithInternalUser('update', {
index: '.kibana',
type: 'doc',
id: `config:${packageJSON.kibana.version}`,
body: {
'doc': {
"type": 'config',
"config": {
"defaultIndex": id
}
}
}
})
.then((resp) => {
server.log([blueWazuh, 'initialize', 'info'], 'Successfully set to default index: ' + id);
})
.catch((err) => {
server.log([blueWazuh, 'initialize', 'error'], 'Could not default the index.' + err);
});
};

// Create index pattern TODO: remove hardcoded index-patterns ids
const createIndexPattern = () => {
server.log([blueWazuh, 'initialize', 'info'], `Creating index pattern: ${index_pattern}`);
Expand All @@ -183,8 +158,6 @@ module.exports = (server, options) => {
})
.then((resp) => {
server.log([blueWazuh, 'initialize', 'info'], 'Created index pattern: ' + index_pattern);
// Set the index-pattern as default in the Kibana configuration
setDefaultKibanaSettings('f1175040-d5c5-11e7-8ef5-a5944cf52264');
// Import objects (dashboards and visualizations)
importObjects('f1175040-d5c5-11e7-8ef5-a5944cf52264');
importAppObjects('f1175040-d5c5-11e7-8ef5-a5944cf52264');
Expand Down
Loading

0 comments on commit 692721b

Please sign in to comment.