diff --git a/x-pack/plugins/reporting/server/routes/jobs.js b/x-pack/plugins/reporting/server/routes/jobs.js index 2639fc103bbde..afbdb9cc7e213 100644 --- a/x-pack/plugins/reporting/server/routes/jobs.js +++ b/x-pack/plugins/reporting/server/routes/jobs.js @@ -124,6 +124,16 @@ export function jobs(server) { const { docId } = request.params; let response = await jobResponseHandler(request.pre.management.jobTypes, request.pre.user, h, { docId }); + const { statusCode } = response; + + if (statusCode !== 200) { + const logLevel = statusCode === 500 ? 'error' : 'debug'; + server.log( + [logLevel, "reporting", "download"], + `Report ${docId} has non-OK status: [${statusCode}] Reason: [${JSON.stringify(response.source)}]` + ); + } + if (!response.isBoom) { response = response.header('accept-ranges', 'none'); } diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index a9192077791f4..fe070c3445a68 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -6,7 +6,7 @@ require('@kbn/plugin-helpers').babelRegister(); require('@kbn/test').runTestsCli([ - // require.resolve('../test/reporting/configs/chromium_api.js'), + require.resolve('../test/reporting/configs/chromium_api.js'), // require.resolve('../test/reporting/configs/chromium_functional.js'), // require.resolve('../test/reporting/configs/phantom_api.js'), // require.resolve('../test/reporting/configs/phantom_functional.js'), diff --git a/x-pack/test/reporting/configs/api.js b/x-pack/test/reporting/configs/api.js index 3723390c971b0..7c30f299f3f46 100644 --- a/x-pack/test/reporting/configs/api.js +++ b/x-pack/test/reporting/configs/api.js @@ -30,6 +30,7 @@ export async function getReportingApiConfig({ readConfigFile }) { serverArgs: [ ...apiConfig.get('kbnTestServer.serverArgs'), `--optimize.enabled=true`, + '--logging.events.log', JSON.stringify(['info', 'warning', 'error', 'fatal', 'optimize', 'reporting']) ], }, }; diff --git a/x-pack/test/reporting/configs/chromium_api.js b/x-pack/test/reporting/configs/chromium_api.js index 1d643c4d359df..461c6c0df5271 100644 --- a/x-pack/test/reporting/configs/chromium_api.js +++ b/x-pack/test/reporting/configs/chromium_api.js @@ -22,7 +22,6 @@ export default async function ({ readConfigFile }) { ...reportingApiConfig.kbnTestServer.serverArgs, `--xpack.reporting.capture.browser.type=chromium`, `--xpack.spaces.enabled=false`, - `--logging.verbose=true`, ], }, }; diff --git a/x-pack/test/reporting/configs/functional.js b/x-pack/test/reporting/configs/functional.js index 82d38ccde3119..4eafa10369e93 100644 --- a/x-pack/test/reporting/configs/functional.js +++ b/x-pack/test/reporting/configs/functional.js @@ -21,9 +21,15 @@ export async function getFunctionalConfig({ readConfigFile }) { junit: { reportName: 'X-Pack Reporting Functional Tests', }, - kbnTestServer: xPackFunctionalTestsConfig.get('kbnTestServer'), + kbnTestServer: { + ...xPackFunctionalTestsConfig.get('kbnTestServer'), + serverArgs: [ + ...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'), + '--logging.events.log', JSON.stringify(['info', 'warning', 'error', 'fatal', 'optimize', 'reporting']) + ], + }, testFiles: [require.resolve('../functional')], }; } -export default getFunctionalConfig; \ No newline at end of file +export default getFunctionalConfig; diff --git a/x-pack/test/reporting/configs/phantom_functional.js b/x-pack/test/reporting/configs/phantom_functional.js index e9a61ee813cf2..b0e7ba6f29ce7 100644 --- a/x-pack/test/reporting/configs/phantom_functional.js +++ b/x-pack/test/reporting/configs/phantom_functional.js @@ -21,7 +21,6 @@ export default async function ({ readConfigFile }) { serverArgs: [ ...functionalConfig.kbnTestServer.serverArgs, `--xpack.reporting.capture.browser.type=phantom`, - `--logging.verbose=true`, ], }, };