Skip to content

Commit

Permalink
Merge branch 'master' into a11y_kibana_overview
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 10, 2021
2 parents 781d4c6 + 38a6475 commit 339205b
Show file tree
Hide file tree
Showing 121 changed files with 2,132 additions and 1,305 deletions.
3 changes: 2 additions & 1 deletion .ci/Jenkinsfile_security_cypress
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ kibanaPipeline(timeoutMinutes: 180) {
) {
catchError {
withEnv([
'CI_PARALLEL_PROCESS_NUMBER=1'
'CI_PARALLEL_PROCESS_NUMBER=1',
'IGNORE_SHIP_CI_STATS_ERROR=true',
]) {
def job = 'xpack-securityCypress'

Expand Down
5 changes: 4 additions & 1 deletion .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ kibanaPipeline(timeoutMinutes: 150) {
message: "[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure",
) {
retryable.enable(2)
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
withEnv([
"ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}",
'IGNORE_SHIP_CI_STATS_ERROR=true',
]) {
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
Expand Down
4 changes: 0 additions & 4 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,6 @@ using the CURL scripts in the scripts folder.
|Visualize geo data from Elasticsearch or 3rd party geo-services.
|{kib-repo}blob/{branch}/x-pack/plugins/maps_file_upload/README.md[mapsFileUpload]
|Deprecated - plugin targeted for removal and will get merged into file_upload plugin
|{kib-repo}blob/{branch}/x-pack/plugins/maps_legacy_licensing/README.md[mapsLegacyLicensing]
|This plugin provides access to the detailed tile map services from Elastic.
Expand Down
13 changes: 12 additions & 1 deletion docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ for example, `logstash-*`.
==== Default logging timezone is now the system's timezone
*Details:* In prior releases the timezone used in logs defaulted to UTC. We now use the host machine's timezone by default.

*Impact:* To restore the previous behavior, in kibana.yml set `logging.timezone: UTC`.
*Impact:* To restore the previous behavior, in kibana.yml use the pattern layout, with a date modifier:
[source,yaml]
-------------------
logging:
appenders:
console:
kind: console
layout:
kind: pattern
pattern: "%date{ISO8601_TZ}{UTC}"
-------------------
See https://github.com/elastic/kibana/pull/90368 for more details.

[float]
==== Responses are never logged by default
Expand Down
3 changes: 2 additions & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ suppress all logging output. *Default: `false`*
| Set to the canonical time zone ID
(for example, `America/Los_Angeles`) to log events using that time zone.
For possible values, refer to
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones[database time zones]. *Default: `UTC`*
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones[database time zones].
When not set, log events use the host timezone

| [[logging-verbose]] `logging.verbose:` {ess-icon}
| Set to `true` to log all events, including system usage information and all
Expand Down
12 changes: 10 additions & 2 deletions packages/kbn-dev-utils/src/ci_stats_reporter/ship_ci_stats_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ export function shipCiStatsCli() {
throw createFlagError('expected --metrics to be a string');
}

const maybeFail = (message: string) => {
const error = createFailError(message);
if (process.env.IGNORE_SHIP_CI_STATS_ERROR === 'true') {
error.exitCode = 0;
}
return error;
};

const reporter = CiStatsReporter.fromEnv(log);

if (!reporter.isEnabled()) {
throw createFailError('unable to initilize the CI Stats reporter');
throw maybeFail('unable to initilize the CI Stats reporter');
}

for (const path of metricPaths) {
Expand All @@ -35,7 +43,7 @@ export function shipCiStatsCli() {
if (await reporter.metrics(JSON.parse(json))) {
log.success('shipped metrics from', path);
} else {
throw createFailError('failed to ship metrics');
throw maybeFail('failed to ship metrics');
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ pageLoadAssetSize:
presentationUtil: 28545
spacesOss: 18817
osquery: 107090
mapsFileUpload: 23775
fileUpload: 25664
20 changes: 20 additions & 0 deletions src/core/server/config/deprecation/core_deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,24 @@ describe('core deprecations', () => {
expect(messages).toEqual([]);
});
});

describe('logging.timezone', () => {
it('warns when ops events are used', () => {
const { messages } = applyCoreDeprecations({
logging: { timezone: 'GMT' },
});
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"logging.timezone\\" has been deprecated and will be removed in 8.0. To set the timezone moving forward, please add a timezone date modifier to the log pattern in your logging configuration. For more details, see https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.md",
]
`);
});

it('does not warn when other events are configured', () => {
const { messages } = applyCoreDeprecations({
logging: { events: { log: '*' } },
});
expect(messages).toEqual([]);
});
});
});
13 changes: 13 additions & 0 deletions src/core/server/config/deprecation/core_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ const requestLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, l
return settings;
};

const timezoneLoggingDeprecation: ConfigDeprecation = (settings, fromPath, log) => {
if (has(settings, 'logging.timezone')) {
log(
'"logging.timezone" has been deprecated and will be removed ' +
'in 8.0. To set the timezone moving forward, please add a timezone date modifier to the log pattern ' +
'in your logging configuration. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.md'
);
}
return settings;
};

export const coreDeprecationProvider: ConfigDeprecationProvider = ({ rename, unusedFromRoot }) => [
unusedFromRoot('savedObjects.indexCheckTimeout'),
unusedFromRoot('server.xsrf.token'),
Expand Down Expand Up @@ -163,4 +175,5 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({ rename, unu
mapManifestServiceUrlDeprecation,
opsLoggingEventDeprecation,
requestLoggingEventDeprecation,
timezoneLoggingDeprecation,
];
20 changes: 10 additions & 10 deletions src/core/server/legacy/integration_tests/logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('logging service', () => {
const loggedString = getPlatformLogsFromMock(mockConsoleLog);
expect(loggedString).toMatchInlineSnapshot(`
Array [
"[xxxx-xx-xxTxx:xx:xx.xxxZ][INFO ][test-file] handled by NP",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][INFO ][test-file] handled by NP",
]
`);
});
Expand Down Expand Up @@ -131,9 +131,9 @@ describe('logging service', () => {

expect(getPlatformLogsFromMock(mockConsoleLog)).toMatchInlineSnapshot(`
Array [
"[xxxx-xx-xxTxx:xx:xx.xxxZ][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][ERROR][test-file] error",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][ERROR][test-file] error",
]
`);

Expand Down Expand Up @@ -162,9 +162,9 @@ describe('logging service', () => {

expect(getPlatformLogsFromMock(mockConsoleLog)).toMatchInlineSnapshot(`
Array [
"[xxxx-xx-xxTxx:xx:xx.xxxZ][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][ERROR][test-file] error",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][ERROR][test-file] error",
]
`);

Expand Down Expand Up @@ -199,9 +199,9 @@ describe('logging service', () => {

expect(getPlatformLogsFromMock(mockConsoleLog)).toMatchInlineSnapshot(`
Array [
"[xxxx-xx-xxTxx:xx:xx.xxxZ][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxxZ][ERROR][test-file] error",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][INFO ][test-file] info",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][WARN ][test-file] warn",
"[xxxx-xx-xxTxx:xx:xx.xxx-xx:xx][ERROR][test-file] error",
]
`);

Expand Down
31 changes: 16 additions & 15 deletions src/core/server/logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ Example of `%meta` output:

##### date
Outputs the date of the logging event. The date conversion specifier may be followed by a set of braces containing a name of predefined date format and canonical timezone name.
Timezone name is expected to be one from [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
Timezone name is expected to be one from [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
Timezone defaults to the host timezone when not explicitly specified.
Example of `%date` output:

| Conversion pattern | Example |
Expand Down Expand Up @@ -410,22 +411,22 @@ loggerWithNestedContext.debug('Message with `debug` log level.');

And assuming logger for `server` context with `console` appender and `trace` level was used, console output will look like this:
```bash
[2017-07-25T18:54:41.639Z][TRACE][server] Message with `trace` log level.
[2017-07-25T18:54:41.639Z][DEBUG][server] Message with `debug` log level.
[2017-07-25T18:54:41.639Z][INFO ][server] Message with `info` log level.
[2017-07-25T18:54:41.639Z][WARN ][server] Message with `warn` log level.
[2017-07-25T18:54:41.639Z][ERROR][server] Message with `error` log level.
[2017-07-25T18:54:41.639Z][FATAL][server] Message with `fatal` log level.

[2017-07-25T18:54:41.639Z][TRACE][server.http] Message with `trace` log level.
[2017-07-25T18:54:41.639Z][DEBUG][server.http] Message with `debug` log level.
[2017-07-25T11:54:41.639-07:00][TRACE][server] Message with `trace` log level.
[2017-07-25T11:54:41.639-07:00][DEBUG][server] Message with `debug` log level.
[2017-07-25T11:54:41.639-07:00][INFO ][server] Message with `info` log level.
[2017-07-25T11:54:41.639-07:00][WARN ][server] Message with `warn` log level.
[2017-07-25T11:54:41.639-07:00][ERROR][server] Message with `error` log level.
[2017-07-25T11:54:41.639-07:00][FATAL][server] Message with `fatal` log level.

[2017-07-25T11:54:41.639-07:00][TRACE][server.http] Message with `trace` log level.
[2017-07-25T11:54:41.639-07:00][DEBUG][server.http] Message with `debug` log level.
```

The log will be less verbose with `warn` level for the `server` context:
```bash
[2017-07-25T18:54:41.639Z][WARN ][server] Message with `warn` log level.
[2017-07-25T18:54:41.639Z][ERROR][server] Message with `error` log level.
[2017-07-25T18:54:41.639Z][FATAL][server] Message with `fatal` log level.
[2017-07-25T11:54:41.639-07:00][WARN ][server] Message with `warn` log level.
[2017-07-25T11:54:41.639-07:00][ERROR][server] Message with `error` log level.
[2017-07-25T11:54:41.639-07:00][FATAL][server] Message with `fatal` log level.
```

### Logging config migration
Expand Down Expand Up @@ -488,7 +489,7 @@ logging.root.level: all

#### logging.timezone
Set to the canonical timezone id to log events using that timezone. New logging config allows
to [specify timezone](#date) for `layout: pattern`.
to [specify timezone](#date) for `layout: pattern`. Defaults to host timezone when not specified.
```yaml
logging:
appenders:
Expand Down Expand Up @@ -530,7 +531,7 @@ TBD

| Parameter | Platform log record in **pattern** format | Legacy Platform log record **text** format |
| --------------- | ------------------------------------------ | ------------------------------------------ |
| @timestamp | ISO8601 `2012-01-31T23:33:22.011Z` | Absolute `23:33:22.011` |
| @timestamp | ISO8601_TZ `2012-01-31T23:33:22.011-05:00` | Absolute `23:33:22.011` |
| context | `parent.child` | `['parent', 'child']` |
| level | `DEBUG` | `['debug']` |
| meta | stringified JSON object `{"to": "v8"}` | N/A |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/core/server/logging/layouts/conversions/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ const formats = {
UNIX_MILLIS: 'UNIX_MILLIS',
};

function formatDate(date: Date, dateFormat: string = formats.ISO8601, timezone?: string): string {
function formatDate(
date: Date,
dateFormat: string = formats.ISO8601_TZ,
timezone?: string
): string {
const momentDate = moment(date);
if (timezone) {
momentDate.tz(timezone);
}
momentDate.tz(timezone ?? moment.tz.guess());

switch (dateFormat) {
case formats.ISO8601:
return momentDate.toISOString();
Expand Down
Loading

0 comments on commit 339205b

Please sign in to comment.