Skip to content

Commit

Permalink
Fix some log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel González authored and havidarou committed Apr 25, 2018
1 parent 5cda2c5 commit b3e8ab0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions server/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ module.exports = (server, options) => {

try {
kibana_template = require(KIBANA_TEMPLATE);
console.log(kibana_template.template)
kibana_template.template = wzWrapper.WZ_KIBANA_INDEX + '*'
console.log(kibana_template.template)
} catch (error) {
log('[initialize][createKibanaTemplate]', error.message || error);
server.log([blueWazuh, 'initialize', 'error'], `Could not read the ${wzWrapper.WZ_KIBANA_INDEX} template file.`);
Expand Down Expand Up @@ -388,7 +386,7 @@ module.exports = (server, options) => {
await server.plugins.elasticsearch.waitUntilReady();
return checkKibanaStatus();
} catch (error){
log('[initialize][checkStatus]',error.message || error);
log('[initialize][checkStatus]','Waiting for elasticsearch plugin to be ready...','info');
server.log([blueWazuh, 'initialize', 'info'], 'Waiting for elasticsearch plugin to be ready...');
setTimeout(() => checkStatus(), 3000);
}
Expand Down Expand Up @@ -465,7 +463,7 @@ module.exports = (server, options) => {
config.cluster_info.node = response.body.data.node;
config.cluster_info.cluster = response.body.data.cluster;
} else if (response.body.error) {
log('[initialize][getNodeInformation]', response.body.error || response.body);
log('[initialize][getNodeInformation]', `Could not get cluster/node information for ${config.manager} due to ${response.body.error || response.body}`);
server.log([blueWazuh, 'reindex', 'error'], `Could not get cluster/node information for ${config.manager}`);
}

Expand Down Expand Up @@ -526,7 +524,7 @@ module.exports = (server, options) => {
return;
}
} catch (error) {
log('[initialize][checkVersion]', error.message || error);
log('[initialize][checkVersion]', `API is NOT reachable ${config.manager} due to ${error.message || error}`);
server.log([blueWazuh, 'reindex', 'info'], `API is NOT reachable ${config.manager}`);
// We weren't able to reach the API, reorganize data and fill with sample node and cluster name information
return updateSingleHostInformation(config);
Expand Down Expand Up @@ -581,8 +579,8 @@ module.exports = (server, options) => {
setTimeout(() => swapIndex(), 3000);

} catch(error) {
log('[initialize][reindexOldVersion]', error.message || error);
server.log([blueWazuh, 'reindex', 'error'], 'Could not begin the reindex process: ' + error.message || error);
log('[initialize][reindexOldVersion]', `Could not begin the reindex process due to ${error.message || error}`);
server.log([blueWazuh, 'reindex', 'error'], `Could not begin the reindex process due to ${error.message || error}`);
}
};

Expand Down Expand Up @@ -618,8 +616,8 @@ module.exports = (server, options) => {
setTimeout(() => reachAPIs(), 3000);

} catch(error) {
log('[initialize][swapIndex]', error.message || error);
server.log([blueWazuh, 'reindex', 'error'], 'Could not reindex the new .wazuh: ' + error.message || error);
log('[initialize][swapIndex]', `Could not reindex the new .wazuh due to ${error.message || error}`);
server.log([blueWazuh, 'reindex', 'error'], `Could not reindex the new .wazuh due to ${error.message || error}`);
}
};

Expand All @@ -632,8 +630,8 @@ module.exports = (server, options) => {
}
await Promise.all(promises);
} catch(error){
log('[initialize][reachAPIs]', error.message || error);
server.log([blueWazuh, 'reindex', 'error'], 'Something happened while getting old API configuration data: ' + error.message || error);
log('[initialize][reachAPIs]',`Something happened while getting old API configuration data due to ${error.message || error}`);
server.log([blueWazuh, 'reindex', 'error'], `Something happened while getting old API configuration data due to ${error.message || error}`);
}
};

Expand Down

0 comments on commit b3e8ab0

Please sign in to comment.