Skip to content

Commit

Permalink
[8.10] Remove excessively verbose logs (#166525) (#166541)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.10`:
- [Remove excessively verbose logs
(#166525)](#166525)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-14T21:41:10Z","message":"Remove
excessively verbose logs (#166525)\n\nRevert
#162665","sha":"33108a1638d2f153883cfbf6c6127ba7fb051077","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","backport:prev-minor","v8.11.0","v8.10.1"],"number":166525,"url":"https://github.com/elastic/kibana/pull/166525","mergeCommit":{"message":"Remove
excessively verbose logs (#166525)\n\nRevert
#162665","sha":"33108a1638d2f153883cfbf6c6127ba7fb051077"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166525","number":166525,"mergeCommit":{"message":"Remove
excessively verbose logs (#166525)\n\nRevert
#162665","sha":"33108a1638d2f153883cfbf6c6127ba7fb051077"}},{"branch":"8.10","label":"v8.10.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Gerard Soldevila <[email protected]>
  • Loading branch information
kibanamachine and gsoldevila authored Sep 14, 2023
1 parent 7a490ba commit 6957ba8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
try {
kibanaRequest = CoreKibanaRequest.from(request, routeSchemas);
} catch (error) {
this.log.error(`400 Bad Request - ${request.path}`, {
this.log.error(`400 Bad Request`, {
http: { response: { status_code: 400 } },
});

Expand All @@ -216,7 +216,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo

// forward 401 errors from ES client
if (isElasticsearchUnauthorizedError(error)) {
this.log.error(`401 Unauthorized - ${request.path}`, {
this.log.error(`401 Unauthorized`, {
http: { response: { status_code: 401 } },
});
return hapiResponseAdapter.handle(
Expand All @@ -225,7 +225,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
}

// return a generic 500 to avoid error info / stack trace surfacing
this.log.error(`500 Server Error - ${request.path}`, {
this.log.error(`500 Server Error`, {
http: { response: { status_code: 500 } },
});
return hapiResponseAdapter.toInternalError();
Expand Down
22 changes: 11 additions & 11 deletions src/core/server/integration_tests/http/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ describe('Handler', () => {
);

const [message] = loggingSystemMock.collect(logger).error[0];
expect(message).toEqual('500 Server Error - /');
expect(message).toEqual('500 Server Error');
});

it('captures the error if handler throws', async () => {
Expand Down Expand Up @@ -614,7 +614,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -643,7 +643,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -687,7 +687,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"400 Bad Request - /",
"400 Bad Request",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1171,7 +1171,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1584,7 +1584,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1660,7 +1660,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1807,7 +1807,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1840,7 +1840,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1872,7 +1872,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down Expand Up @@ -1904,7 +1904,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export class DefaultSLOInstaller implements SLOInstaller {
await this.sloResourceInstaller.ensureCommonResourcesInstalled();
await this.sloSummaryInstaller.installAndStart();
} catch (error) {
this.logger.error('Failed to install SLO common resources and summary transforms', {
error,
});
this.logger.error('Failed to install SLO common resources and summary transforms');
} finally {
this.isInstalling = false;
clearTimeout(installTimeout);
Expand Down

0 comments on commit 6957ba8

Please sign in to comment.