Skip to content

Commit

Permalink
Merge pull request #258 from sivasamyk/v6.2.2_0.1.27
Browse files Browse the repository at this point in the history
V6.2.2 0.1.27
  • Loading branch information
sivasamyk authored Mar 17, 2018
2 parents 150b00a + 9175310 commit c644ba4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Installation
- Download and install Elasticsearch , Logstash and Kibana
- Logtrail is supported and tested with Kibana 6.x and 5.x
- Install logtrail plugin (requires restart of Kibana after install)
- Kibana 6.2.2 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.26/logtrail-6.2.2-0.1.26.zip`
- Kibana 6.2.2 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.27/logtrail-6.2.2-0.1.27.zip`
- Kibana 5.6.5 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.23/logtrail-5.6.5-0.1.23.zip`
- Other versions : [https://github.com/sivasamyk/logtrail/releases](https://github.com/sivasamyk/logtrail/releases)
- Kibana requires exact match of plugin version to the Kibana version. If you can't find logtrail plugin release for a Kibana release, follow the instrcutions [here](docs/how_to.md#2-update-kibanaversion-in-logtrail-plugin-archive) to update Kibana version in your logtrail plugin archive.
Expand Down
2 changes: 1 addition & 1 deletion logtrail.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logtrail",
"version": "0.1.26",
"version": "0.1.27",
"description": "Plugin to view, search & tail logs in Kibana",
"main": "index.js",
"kibana": {
Expand Down
14 changes: 7 additions & 7 deletions server/routes/init_server_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ function loadConfigFromES(server,context) {
});
}

function updateKeywordInfo(server,indexPattern, fieldKey) {
function updateKeywordInfo(request, server, indexPattern, fieldKey) {
return new Promise((resolve,reject) => {
var field = indexPattern.fields.mapping[fieldKey];
//check if the direct field is of type keyword
checkIfFieldIsKeyword(server,indexPattern, field).then(async function(result) {
checkIfFieldIsKeyword(request, server,indexPattern, field).then(async function(result) {
if (result) {
indexPattern.fields.mapping[fieldKey + ".keyword"] = field;
} else {
//else check if we have .keyword mapping added by logstash template.
result = await checkIfFieldIsKeyword(server,indexPattern, field + ".keyword");
result = await checkIfFieldIsKeyword(request, server,indexPattern, field + ".keyword");
if (result) {
indexPattern.fields.mapping[fieldKey + ".keyword"] = field + ".keyword";
}
Expand All @@ -41,15 +41,15 @@ function updateKeywordInfo(server,indexPattern, fieldKey) {
});
}

function checkIfFieldIsKeyword(server, indexPattern, fieldToCheck) {
function checkIfFieldIsKeyword(request, server, indexPattern, fieldToCheck) {
return new Promise((resolve, reject) => {
const adminCluster = server.plugins.elasticsearch.getCluster('admin');
var request = {
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
var payload = {
index: indexPattern.es.default_index,
fields: fieldToCheck,
ignoreUnavailable: true
};
var resp = adminCluster.callWithInternalUser('fieldCaps',request).then(function(resp) {
var resp = callWithRequest(request, 'fieldCaps', payload).then(function(resp) {
resolve(resp.fields[fieldToCheck].keyword != null);
}).catch(function(error) {
server.log (['info','status'],`Cannot load keyword field for ${fieldToCheck}. will use non-keyword field ${error}`);
Expand Down
4 changes: 2 additions & 2 deletions server/routes/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ module.exports = function (server) {
for (var i = config.index_patterns.length - 1; i >= 0; i--) {
var selected_config = config.index_patterns[i];
if (selected_config.fields.mapping['hostname.keyword'] == null) {
await updateKeywordInfo(server, selected_config, "hostname");
await updateKeywordInfo(server, selected_config, "program");
await updateKeywordInfo(request, server, selected_config, "hostname");
await updateKeywordInfo(request, server, selected_config, "program");
}
}
reply({
Expand Down

0 comments on commit c644ba4

Please sign in to comment.