diff --git a/KibanaConfig.rb b/KibanaConfig.rb index 227935fc9..b785696ac 100644 --- a/KibanaConfig.rb +++ b/KibanaConfig.rb @@ -27,6 +27,10 @@ module KibanaConfig # Results to show per page Per_page = 50 + # Maximum number of lines from multiline fields to display in collapsed view. + # Affects all Default_fields + Max_lines = 5 + # Timezone. Leave this set to 'user' to have the user's browser autocorrect. # Otherwise, set a timezone string # Examples: 'UTC', 'America/Phoenix', 'Europe/Athens', MST diff --git a/lib/kibana-app.rb b/lib/kibana-app.rb index 7bd6df05c..5aa630af6 100644 --- a/lib/kibana-app.rb +++ b/lib/kibana-app.rb @@ -66,6 +66,8 @@ def link_to url_fragment, mode=:full_url result.response['kibana']['default_fields'] = KibanaConfig::Default_fields # Enable clickable URL links result.response['kibana']['clickable_urls'] = KibanaConfig::Clickable_URLs + # Truncate Default_fields after Max_lines in collapsed view + result.response['kibana']['maxlines'] = KibanaConfig::Max_lines JSON.generate(result.response) end diff --git a/public/lib/js/ajax.js b/public/lib/js/ajax.js index fb5c14a1e..268caab34 100644 --- a/public/lib/js/ajax.js +++ b/public/lib/js/ajax.js @@ -873,7 +873,14 @@ function CreateLogTable(objArray, fields, theme, enableHeader) { } var value = value === undefined ? "-" : value.toString(); - var value = xmlEnt(wbr(value),10); + var maxlines = window.resultjson.kibana.maxlines; + var value = xmlEnt(wbr(value, 10)).split('
').slice(0); + if (value.length > maxlines) { + var omitted = value.length - maxlines; + var value = value.slice(0, maxlines).join('
') + '
[...' + omitted + ' lines omitted...]'; + } else { + var value = value.join('
'); + } var value = value.replace(RegExp("@KIBANA_HIGHLIGHT_START@(.*?)@KIBANA_HIGHLIGHT_END@", "g"), function (all, text, char) { return "" + text + "";