Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs Sample Data #22276

Merged
merged 26 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fa05b8a
first take at logs sample data
Aug 22, 2018
f8df0e8
typo
Aug 22, 2018
d690cd6
smaller and same sized images and function rename
Aug 22, 2018
74176da
fixed index pattern so that it matches dataset
Aug 23, 2018
3213662
some dashboard tweaks
Aug 23, 2018
ef08257
tests and updated data set
Aug 24, 2018
06bfaf2
first take at logs sample data
Aug 22, 2018
9f497d3
typo
Aug 22, 2018
cd7c407
smaller and same sized images and function rename
Aug 22, 2018
1aa2d16
fixed index pattern so that it matches dataset
Aug 23, 2018
1f26258
some dashboard tweaks
Aug 23, 2018
19e5c3c
tests and updated data set
Aug 24, 2018
97b98ce
Asawari prettied up the dashboard
Aug 27, 2018
19949cf
Merge branch 'master' of https://github.com/elastic/kibana into logs_…
Aug 27, 2018
040f765
Asawari prettied up the dashboard
Aug 27, 2018
1ac6cda
Asawari prettied up the dashboard
Aug 27, 2018
0a9ab0b
updated screenshot
Aug 27, 2018
1fd97d7
updated dashboard and screenshot
Aug 28, 2018
012d24c
Merge branch 'master' of http://github.com/elastic/kibana into logs_s…
Aug 28, 2018
46b62ed
modify flaky tests
Aug 28, 2018
4faa639
Merge branch 'master' of https://github.com/elastic/kibana into logs_…
Aug 28, 2018
b6086c8
Merge branch 'logs_sample_data' of http://github.com/alexfrancoeur/ki…
Aug 28, 2018
41ce8f6
remove flaky test
Aug 28, 2018
2fc50b0
really listening to Nathan this time
Aug 28, 2018
b6faa50
really listening to Nathan this time (for real)
Aug 28, 2018
b694f12
incorporated Alonas suggestions
Aug 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/server/sample_data/data_sets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
*/

export { flightsSpecProvider } from './flights';
export { logsSpecProvider } from './logs';
167 changes: 167 additions & 0 deletions src/server/sample_data/data_sets/logs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import path from 'path';
import { savedObjects } from './saved_objects';

export function logsSpecProvider() {
return {
id: 'logs',
name: 'Sample web logs',
description: 'Sample data, visualizations, and dashboards for monitoring web logs.',
previewImagePath: '/plugins/kibana/home/sample_data_resources/logs/dashboard.png',
overviewDashboard: 'edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b',
defaultIndex: '90943e30-9a47-11e8-b64d-95841ca0b247',
dataPath: path.join(__dirname, './logs.json.gz'),
fields: {
request: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
geo: {
properties: {
srcdest: {
type: 'keyword'
},
src: {
type: 'keyword'
},
dest: {
type: 'keyword'
},
coordinates: {
type: 'geo_point'
}
}
},
utc_time: {
type: 'date'
},
url: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
message: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
host: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
clientip: {
type: 'ip'
},
response: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
machine: {
properties: {
ram: {
type: 'long'
},
os: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
}
}
},
agent: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
bytes: {
type: 'long'
},
tags: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
},
referer: {
type: 'keyword'
},
ip: {
type: 'ip'
},
timestamp: {
type: 'date'
},
phpmemory: {
type: 'long'
},
memory: {
type: 'double'
},
extension: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256
}
}
}
},
timeFields: ['timestamp'],
currentTimeMarker: '2018-08-01T00:00:00',
preserveDayOfWeekTimeOfDay: true,
savedObjects: savedObjects,
};
}
Binary file not shown.
236 changes: 236 additions & 0 deletions src/server/sample_data/data_sets/logs/saved_objects.js

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion src/server/sample_data/routes/lib/load_data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { loadData } from './load_data';

test('load data', done => {
test('load flight data', done => {
let myDocsCount = 0;
const bulkInsertMock = (docs) => {
myDocsCount += docs.length;
Expand All @@ -30,3 +30,15 @@ test('load data', done => {
done();
});
});

test('load log data', done => {
let myDocsCount = 0;
const bulkInsertMock = (docs) => {
myDocsCount += docs.length;
};
loadData('./src/server/sample_data/data_sets/logs/logs.json.gz', bulkInsertMock, async (err, count) => {
expect(myDocsCount).toBe(14005);
expect(count).toBe(14005);
done();
});
});
2 changes: 2 additions & 0 deletions src/server/sample_data/sample_data_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from './routes';
import {
flightsSpecProvider,
logsSpecProvider,
} from './data_sets';

export function sampleDataMixin(kbnServer, server) {
Expand Down Expand Up @@ -66,4 +67,5 @@ export function sampleDataMixin(kbnServer, server) {
});

server.registerSampleDataset(flightsSpecProvider);
server.registerSampleDataset(logsSpecProvider);
}
44 changes: 39 additions & 5 deletions test/functional/apps/home/_sample_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,39 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.waitUntilLoadingHasFinished();
});

it('should display registered sample data sets', async ()=> {
it('should display registered flights sample data sets', async ()=> {
await retry.try(async () => {
const exists = await PageObjects.home.doesSampleDataSetExist('flights');
expect(exists).to.be(true);
});
});

it('should install sample data set', async ()=> {
it('should display registered logs sample data sets', async ()=> {
await retry.try(async () => {
const exists = await PageObjects.home.doesSampleDataSetExist('logs');
expect(exists).to.be(true);
});
});

it('should install flights sample data set', async ()=> {
await PageObjects.home.addSampleDataSet('flights');
const isInstalled = await PageObjects.home.isSampleDataSetInstalled('flights');
expect(isInstalled).to.be(true);
});

it('should install logs sample data set', async ()=> {
await PageObjects.home.addSampleDataSet('logs');
const isInstalled = await PageObjects.home.isSampleDataSetInstalled('logs');
expect(isInstalled).to.be(true);
});

describe('dashboard', () => {
after(async () => {
afterEach(async () => {
await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData');
await PageObjects.header.waitUntilLoadingHasFinished();
});

it('should launch sample data set dashboard', async ()=> {
it('should launch sample flights data set dashboard', async ()=> {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
const today = new Date();
Expand All @@ -63,6 +76,7 @@ export default function ({ getService, getPageObjects }) {
expect(panelCount).to.be(19);
});


it.skip('pie charts rendered', async () => {
await dashboardExpect.pieSliceCount(4);
});
Expand All @@ -87,15 +101,35 @@ export default function ({ getService, getPageObjects }) {
const tsvb = await find.existsByCssSelector('.vega-view-container');
expect(tsvb).to.be(true);
});

it('should launch sample logs data set dashboard', async ()=> {
await PageObjects.home.launchSampleDataSet('logs');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get this test to pass locally. At this point, the browser is on the flights dashboard so it can not find logs sample data card. I think you should just be able to change the after block (line 67) to afterEach

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nreese I think I should be good now, modified to afterEach

await PageObjects.header.waitUntilLoadingHasFinished();
const today = new Date();
const todayYearMonthDay = today.toISOString().substring(0, 10);
const fromTime = `${todayYearMonthDay} 00:00:00.000`;
const toTime = `${todayYearMonthDay} 23:59:59.999`;
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.be(11);
});

});

// needs to be in describe block so it is run after 'dashboard describe block'
describe('uninstall', () => {
it('should uninstall sample data set', async ()=> {
it('should uninstall flights sample data set', async ()=> {
await PageObjects.home.removeSampleDataSet('flights');
const isInstalled = await PageObjects.home.isSampleDataSetInstalled('flights');
expect(isInstalled).to.be(false);
});

it('should uninstall logs sample data set', async ()=> {
await PageObjects.home.removeSampleDataSet('logs');
const isInstalled = await PageObjects.home.isSampleDataSetInstalled('logs');
expect(isInstalled).to.be(false);
});

});
});
}