Skip to content

Commit

Permalink
Merge pull request #292 from sivasamyk/issue/55
Browse files Browse the repository at this point in the history
Issue/55
  • Loading branch information
sivasamyk committed Jul 7, 2018
2 parents ace9292 + b821371 commit d6b5eb6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
3 changes: 2 additions & 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.3.0 : `./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.28/logtrail-6.3.0-0.1.28.zip`
- 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`
- 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 All @@ -41,6 +41,7 @@ Configuration
Value of 0 means logtrail will search in all available logs by default.
- `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.
- `display_timestamp_format` - Format to display the timestamp in Event Viewer. For list of valid value refer [here](http://momentjs.com/docs/#/displaying/)
- `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`.
- `fields` - Edit this parameter to map the event fields in ES to logtrail fields
- `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.
- `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)
Expand Down
1 change: 1 addition & 0 deletions logtrail.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"default_time_range_in_days" : 0,
"max_hosts": 100,
"max_events_to_keep_in_viewer": 5000,
"default_search": "",
"fields" : {
"mapping" : {
"timestamp" : "@timestamp",
Expand Down
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.28",
"version": "0.1.29",
"description": "Plugin to view, search & tail logs in Kibana",
"main": "index.js",
"kibana": {
Expand Down
44 changes: 24 additions & 20 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,11 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams,
var eventIds = new Set();

function init() {
//init scope vars from get params if available
if ($routeParams.q) {
$scope.userSearchText = $routeParams.q === '*' ? null : $routeParams.q;
searchText = $routeParams.q;
}

if ($routeParams.h) {
$scope.selectedHost = $routeParams.h === 'All' ? null : $routeParams.h;
}

if ($routeParams.t) {
if ($routeParams.t === 'Now' || $routeParams.t == null) {
$scope.pickedDateTime = null;
$scope.userDateTime = null;
} else {
$scope.pickedDateTime = convertStringToDate($routeParams.t);
$scope.userDateTimeSeeked = $routeParams.t;
}
}

$http.get(chrome.addBasePath('/logtrail/config')).then(function (resp) {
if (resp.data.ok) {
config = resp.data.config;
}

//populate index_patterns
for (let i = config.index_patterns.length - 1; i >= 0; i--) {
$scope.index_patterns.push(config.index_patterns[i].es.default_index);
Expand All @@ -92,6 +73,29 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams,
selectedIndexConfig = config.index_patterns[0];
}
$scope.selected_index_pattern = selectedIndexConfig.es.default_index;

//init scope vars from get params if available
if ($routeParams.q) {
$scope.userSearchText = $routeParams.q === '*' ? null : $routeParams.q;
searchText = $routeParams.q;
} else if (selectedIndexConfig.default_search) {
$scope.userSearchText = selectedIndexConfig.default_search;
searchText = selectedIndexConfig.default_search
}

if ($routeParams.h) {
$scope.selectedHost = $routeParams.h === 'All' ? null : $routeParams.h;
}

if ($routeParams.t) {
if ($routeParams.t === 'Now' || $routeParams.t == null) {
$scope.pickedDateTime = null;
$scope.userDateTime = null;
} else {
$scope.pickedDateTime = convertStringToDate($routeParams.t);
$scope.userDateTimeSeeked = $routeParams.t;
}
}
initialize();
});
};
Expand Down

0 comments on commit d6b5eb6

Please sign in to comment.