Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions docs/kibana-yml.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ to this Kibana instance.
`kibana.index:`:: *Default: ".kibana"* Kibana uses an index in Elasticsearch to store saved searches, visualizations and
dashboards. Kibana creates a new index if the index doesn’t already exist.
`kibana.defaultAppId:`:: *Default: "discover"* The default application to load.
`kibana.addDataMaxBytes:`:: *Default: 1073741824* The maximum upload size in bytes for the CSV Upload wizard
[[tilemap-settings]]`tilemap.url:`:: *Default: `"https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana"`* The URL to the tile
service that Kibana uses to display map tiles in tilemap visualizations.
`tilemap.options.minZoom:`:: *Default: 1* The minimum zoom level.
Expand Down
8 changes: 6 additions & 2 deletions src/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ module.exports = function (kibana) {
return new kibana.Plugin({
id: 'kibana',
config: function (Joi) {
const ONE_GIGABYTE = 1024 * 1024 * 1024;

return Joi.object({
enabled: Joi.boolean().default(true),
defaultAppId: Joi.string().default('discover'),
index: Joi.string().default('.kibana')
index: Joi.string().default('.kibana'),
addDataMaxBytes: Joi.number().default(ONE_GIGABYTE)
}).default();
},

Expand All @@ -41,7 +44,8 @@ module.exports = function (kibana) {
let config = server.config();
return {
kbnDefaultAppId: config.get('kibana.defaultAppId'),
tilemap: config.get('tilemap')
tilemap: config.get('tilemap'),
addDataMaxBytes: config.get('kibana.addDataMaxBytes')
};
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2><em>Pick a CSV file to get started.</em>
<button class="btn btn-primary btn-lg controls upload" ng-click>
Select File
</button>
<div>Maximum upload file size: 1 GB</div>
<div>Maximum upload file size: {{ wizard.maxBytesFormatted }}</div>
</div>
</file-upload>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import modules from 'ui/modules';
import validateHeaders from './lib/validate_headers';
import template from './parse_csv_step.html';
import './styles/_add_data_parse_csv_step.less';
import numeral from '@spalger/numeral';

modules.get('apps/management')
.directive('parseCsvStep', function () {
.directive('parseCsvStep', function (addDataMaxBytes) {
return {
restrict: 'E',
template: template,
Expand All @@ -21,6 +22,8 @@ modules.get('apps/management')
const maxSampleRows = 10;
const maxSampleColumns = 20;

this.maxBytesFormatted = numeral(addDataMaxBytes).format('0 b');
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't seem this is used anywhere. Did you mean to use it in the formatted error message on line 63?

Copy link
Member

Choose a reason for hiding this comment

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

It's used in the view

Copy link
Contributor

Choose a reason for hiding this comment

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


this.delimiterOptions = [
{
label: 'comma',
Expand Down Expand Up @@ -55,6 +58,13 @@ modules.get('apps/management')
this.formattedErrors = [];
this.formattedWarnings = [];

if (this.file.size > addDataMaxBytes) {
this.formattedErrors.push(
`File size (${this.file.size} bytes) is greater than the configured limit of ${addDataMaxBytes} bytes`
);
return;
}

const config = _.assign(
{
header: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { patternToIngest } from '../../../../common/lib/convert_pattern_and_inge
import { PassThrough } from 'stream';
import JSONStream from 'JSONStream';

const ONE_GIGABYTE = 1024 * 1024 * 1024;

export function registerData(server) {
const maxBytes = server.config().get('kibana.addDataMaxBytes');

server.route({
path: '/api/kibana/{id}/_data',
method: 'POST',
config: {
payload: {
output: 'stream',
maxBytes: ONE_GIGABYTE
maxBytes
}
},
handler: function (req, reply) {
Expand Down