mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Log correct Kibana URL when TLS is enabled and log it only once. (#20721)
This commit is contained in:
parent
0f5322e3a5
commit
2a645d2252
9 changed files with 54 additions and 55 deletions
|
@ -13,44 +13,15 @@ Object {
|
|||
],
|
||||
"type": "log",
|
||||
},
|
||||
Object {
|
||||
"@timestamp": "## @timestamp ##",
|
||||
"message": "starting server :tada:",
|
||||
"pid": "## PID ##",
|
||||
"tags": Array [
|
||||
"info",
|
||||
"server",
|
||||
],
|
||||
"type": "log",
|
||||
},
|
||||
Object {
|
||||
"@timestamp": "## @timestamp ##",
|
||||
"message": "registering route handler for [/core]",
|
||||
"pid": "## PID ##",
|
||||
"tags": Array [
|
||||
"info",
|
||||
"http",
|
||||
],
|
||||
"type": "log",
|
||||
},
|
||||
Object {
|
||||
"@timestamp": "## @timestamp ##",
|
||||
"message": "starting http server [localhost:8274]",
|
||||
"pid": "## PID ##",
|
||||
"tags": Array [
|
||||
"info",
|
||||
"http",
|
||||
"server",
|
||||
],
|
||||
"type": "log",
|
||||
},
|
||||
Object {
|
||||
"@timestamp": "## @timestamp ##",
|
||||
"message": "Server running at http://localhost:8274",
|
||||
"pid": "## PID ##",
|
||||
"tags": Array [
|
||||
"listening",
|
||||
"info",
|
||||
"http",
|
||||
"server",
|
||||
"listening",
|
||||
],
|
||||
"type": "log",
|
||||
},
|
||||
|
|
|
@ -18,14 +18,14 @@ Object {
|
|||
|
||||
exports[`register route handler 1`] = `
|
||||
Object {
|
||||
"debug": Array [],
|
||||
"error": Array [],
|
||||
"fatal": Array [],
|
||||
"info": Array [
|
||||
"debug": Array [
|
||||
Array [
|
||||
"registering route handler for [/foo]",
|
||||
],
|
||||
],
|
||||
"error": Array [],
|
||||
"fatal": Array [],
|
||||
"info": Array [],
|
||||
"log": Array [],
|
||||
"trace": Array [],
|
||||
"warn": Array [],
|
||||
|
|
|
@ -83,9 +83,13 @@ export class HttpServer {
|
|||
});
|
||||
}
|
||||
|
||||
this.log.info(`starting http server [${config.host}:${config.port}]`);
|
||||
|
||||
await this.server.start();
|
||||
|
||||
this.log.info(
|
||||
`Server running at ${this.server.info.uri}${config.rewriteBasePath ? config.basePath : ''}`,
|
||||
// The "legacy" Kibana will output log records with `listening` tag even if `quiet` logging mode is enabled.
|
||||
{ tags: ['listening'] }
|
||||
);
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
|
|
|
@ -85,7 +85,7 @@ export class HttpService implements CoreService {
|
|||
'Router will **not** be applied.'
|
||||
);
|
||||
} else {
|
||||
this.log.info(`registering route handler for [${router.path}]`);
|
||||
this.log.debug(`registering route handler for [${router.path}]`);
|
||||
this.httpServer.registerRouter(router);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export class Server {
|
|||
}
|
||||
|
||||
public async start() {
|
||||
this.log.info('starting server :tada:');
|
||||
this.log.debug('starting server :tada:');
|
||||
|
||||
const router = new Router('/core');
|
||||
router.get({ path: '/', validate: false }, async (req, res) => res.ok({ version: '0.0.1' }));
|
||||
|
|
|
@ -72,5 +72,25 @@ Array [
|
|||
"message-8-with-message",
|
||||
2012-02-01T11:22:33.044Z,
|
||||
],
|
||||
Array [
|
||||
Array [
|
||||
"info",
|
||||
"context-9",
|
||||
"sub-context-9",
|
||||
],
|
||||
"message-9-with-message",
|
||||
2012-02-01T11:22:33.044Z,
|
||||
],
|
||||
Array [
|
||||
Array [
|
||||
"info",
|
||||
"context-10",
|
||||
"sub-context-10",
|
||||
"tag1",
|
||||
"tag2",
|
||||
],
|
||||
"message-10-with-message",
|
||||
2012-02-01T11:22:33.044Z,
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -86,6 +86,20 @@ test('`append()` correctly pushes records to legacy platform.', () => {
|
|||
message: 'message-8-with-message',
|
||||
timestamp,
|
||||
},
|
||||
{
|
||||
context: 'context-9.sub-context-9',
|
||||
level: LogLevel.Info,
|
||||
message: 'message-9-with-message',
|
||||
timestamp,
|
||||
meta: { someValue: 3 },
|
||||
},
|
||||
{
|
||||
context: 'context-10.sub-context-10',
|
||||
level: LogLevel.Info,
|
||||
message: 'message-10-with-message',
|
||||
timestamp,
|
||||
meta: { tags: ['tag1', 'tag2'] },
|
||||
},
|
||||
];
|
||||
|
||||
const rawKbnServerMock = {
|
||||
|
|
|
@ -41,12 +41,10 @@ export class LegacyAppender implements DisposableAppender {
|
|||
* write record to the configured destination.
|
||||
* @param record `LogRecord` instance to forward to.
|
||||
*/
|
||||
public append(record: LogRecord) {
|
||||
this.kbnServer.log(
|
||||
[record.level.id.toLowerCase(), ...record.context.split('.')],
|
||||
record.error || record.message,
|
||||
record.timestamp
|
||||
);
|
||||
public append({ level, context, message, error, timestamp, meta = {} }: LogRecord) {
|
||||
const tags = [level.id.toLowerCase(), ...context.split('.'), ...(meta.tags || [])];
|
||||
|
||||
this.kbnServer.log(tags, error || message, timestamp);
|
||||
}
|
||||
|
||||
public async dispose() {
|
||||
|
|
|
@ -140,10 +140,7 @@ export default class KbnServer {
|
|||
* @return undefined
|
||||
*/
|
||||
async listen() {
|
||||
const {
|
||||
server,
|
||||
config,
|
||||
} = this;
|
||||
const { server } = this;
|
||||
|
||||
await this.ready();
|
||||
await fromNode(cb => server.start(cb));
|
||||
|
@ -153,11 +150,6 @@ export default class KbnServer {
|
|||
process.send(['WORKER_LISTENING']);
|
||||
}
|
||||
|
||||
server.log(['listening', 'info'], `Server running at ${server.info.uri}${
|
||||
config.get('server.rewriteBasePath')
|
||||
? config.get('server.basePath')
|
||||
: ''
|
||||
}`);
|
||||
return server;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue