Skip to content

Commit d6b5eb6

Browse files
authored
Merge pull request #292 from sivasamyk/issue/55
Issue/55
2 parents ace9292 + b821371 commit d6b5eb6

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Installation
2525
- Download and install Elasticsearch , Logstash and Kibana
2626
- Logtrail is supported and tested with Kibana 6.x and 5.x
2727
- Install logtrail plugin (requires restart of Kibana after install)
28-
- Kibana 6.3.0 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.28/logtrail-6.3.0-0.1.28.zip`
28+
- Kibana 6.3.0 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.29/logtrail-6.3.0-0.1.29.zip`
2929
- 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`
3030
- Other versions : [https://github.com/sivasamyk/logtrail/releases](https://github.com/sivasamyk/logtrail/releases)
3131
- 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.
@@ -41,6 +41,7 @@ Configuration
4141
Value of 0 means logtrail will search in all available logs by default.
4242
- `display_timezone` - Timezone to display the timestamp in Event Viewer. e.g. `America/Los_Angeles`. Default value of `local` will use the timezone of browser. The time specified in `Seek To` popup will always use browser timezone.
4343
- `display_timestamp_format` - Format to display the timestamp in Event Viewer. For list of valid value refer [here](http://momentjs.com/docs/#/displaying/)
44+
- `default_search` - if specified, this will applied as default search text while launching logtrail. The value can be any search text. e.g. `ssh` - shows all logs with `ssh` in message field. or `log_level:SEVERE` - shows all logs where `log_level` field is `SEVERE`. The field name should be a valid field in elasticsearch document. The default search field is the field mapped to `message`.
4445
- `fields` - Edit this parameter to map the event fields in ES to logtrail fields
4546
- `timestamp` - maps to @timestamp field inserted by logstash. This will be used for querying internally. Logtrail recommends @timestamp to be stored in UTC in ES.
4647
- `hostname` - hostname from where the events were received. Also used by hostname filter. Hostname field should be of type keyword. For more info checkout [Hostname field need to be of type keyword](docs/how_to.md#1-hostname-field-need-to-be-of-type-keyword)

logtrail.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"default_time_range_in_days" : 0,
1414
"max_hosts": 100,
1515
"max_events_to_keep_in_viewer": 5000,
16+
"default_search": "",
1617
"fields" : {
1718
"mapping" : {
1819
"timestamp" : "@timestamp",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logtrail",
3-
"version": "0.1.28",
3+
"version": "0.1.29",
44
"description": "Plugin to view, search & tail logs in Kibana",
55
"main": "index.js",
66
"kibana": {

public/app.js

+24-20
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,11 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams,
5252
var eventIds = new Set();
5353

5454
function init() {
55-
//init scope vars from get params if available
56-
if ($routeParams.q) {
57-
$scope.userSearchText = $routeParams.q === '*' ? null : $routeParams.q;
58-
searchText = $routeParams.q;
59-
}
60-
61-
if ($routeParams.h) {
62-
$scope.selectedHost = $routeParams.h === 'All' ? null : $routeParams.h;
63-
}
64-
65-
if ($routeParams.t) {
66-
if ($routeParams.t === 'Now' || $routeParams.t == null) {
67-
$scope.pickedDateTime = null;
68-
$scope.userDateTime = null;
69-
} else {
70-
$scope.pickedDateTime = convertStringToDate($routeParams.t);
71-
$scope.userDateTimeSeeked = $routeParams.t;
72-
}
73-
}
55+
7456
$http.get(chrome.addBasePath('/logtrail/config')).then(function (resp) {
7557
if (resp.data.ok) {
7658
config = resp.data.config;
7759
}
78-
7960
//populate index_patterns
8061
for (let i = config.index_patterns.length - 1; i >= 0; i--) {
8162
$scope.index_patterns.push(config.index_patterns[i].es.default_index);
@@ -92,6 +73,29 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams,
9273
selectedIndexConfig = config.index_patterns[0];
9374
}
9475
$scope.selected_index_pattern = selectedIndexConfig.es.default_index;
76+
77+
//init scope vars from get params if available
78+
if ($routeParams.q) {
79+
$scope.userSearchText = $routeParams.q === '*' ? null : $routeParams.q;
80+
searchText = $routeParams.q;
81+
} else if (selectedIndexConfig.default_search) {
82+
$scope.userSearchText = selectedIndexConfig.default_search;
83+
searchText = selectedIndexConfig.default_search
84+
}
85+
86+
if ($routeParams.h) {
87+
$scope.selectedHost = $routeParams.h === 'All' ? null : $routeParams.h;
88+
}
89+
90+
if ($routeParams.t) {
91+
if ($routeParams.t === 'Now' || $routeParams.t == null) {
92+
$scope.pickedDateTime = null;
93+
$scope.userDateTime = null;
94+
} else {
95+
$scope.pickedDateTime = convertStringToDate($routeParams.t);
96+
$scope.userDateTimeSeeked = $routeParams.t;
97+
}
98+
}
9599
initialize();
96100
});
97101
};

0 commit comments

Comments
 (0)