Skip to content

[Stack Monitoring] Fix Recent Log Entries timezone#249016

Merged
jbudz merged 1 commit intoelastic:mainfrom
kapral18:fix/stack-monitoring/fix-tz-in-recent-log-entries
Jan 14, 2026
Merged

[Stack Monitoring] Fix Recent Log Entries timezone#249016
jbudz merged 1 commit intoelastic:mainfrom
kapral18:fix/stack-monitoring/fix-tz-in-recent-log-entries

Conversation

@kapral18
Copy link
Contributor

@kapral18 kapral18 commented Jan 14, 2026

Closes #120292

Summary

The Stack Monitoring Recent Log Entries table now respects the Kibana dateFormat:tz advanced setting.

Details

  • Fixes formatDateTimeLocal to treat dateFormat:tz values of Browser/null/unset as the browser-guessed timezone
  • Keeps explicit timezone values (e.g. UTC, Asia/Seoul) working as expected
  • Adds unit tests covering explicit timezone, Browser, and default/unset behavior

Demo

Current locale is UTC+1 (value should be 2:26)

Before

SCR-20260114-myjp

After

SCR-20260114-mymj

Test plan

  • node scripts/jest x-pack/platform/plugins/private/monitoring/common/formatting.test.ts
  • Manual: change Stack Management → Advanced Settings → Time zone (dateFormat:tz) and confirm the Recent Log Entries timestamp updates

Manual test data (optional)

If you don't already have Stack Monitoring data available locally, you can create a minimal set of documents via Kibana → Dev Tools → Console.

Pick values for:

  • <ISO_TIMESTAMP>: an ISO timestamp like 2026-01-14T16:07:52.324Z
  • <EPOCH_MS>: the same moment as epoch millis like 1768406872324

Then run:

  1. Create a minimal cluster stats doc (note the timestamp field):
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "timestamp": <EPOCH_MS>,
  "type": "cluster_stats",
  "metricset": { "name": "cluster_stats" },
  "data_stream": { "type": "metrics", "dataset": "elasticsearch.stack_monitoring.cluster_stats", "namespace": "default" },
  "cluster_uuid": "tz-test-cluster",
  "cluster_name": "tz-test-cluster",
  "license": { "status": "active", "type": "trial", "expiry_date_in_millis": 1894665600000 }
}
  1. Create a minimal Elasticsearch server log doc for the same cluster:
POST logs-elasticsearch.server-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "message": "TZ regression test log entry - should show in browser timezone",
  "service": { "type": "elasticsearch" },
  "event": { "dataset": "elasticsearch.server" },
  "log": { "level": "INFO" },
  "elasticsearch": {
    "cluster": { "uuid": "tz-test-cluster" },
    "node": { "name": "test-node-1" },
    "component": "test-component"
  }
}
  1. In Kibana:
  • Set the time picker to a range that includes <ISO_TIMESTAMP> (e.g. Last 15 minutes if you used “now - 5m”)
  • Go to Stack Monitoring → Elasticsearch → Overview and confirm Recent Log Entries shows the row
  • Flip Stack Management → Advanced Settings → Time zone (dateFormat:tz) between Browser and UTC and confirm the displayed timestamp shifts accordingly
  1. Cleanup (optional):
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true
{ "query": { "term": { "cluster_uuid": "tz-test-cluster" } } }
POST logs-elasticsearch.*-*/_delete_by_query?refresh=true
{ "query": { "term": { "elasticsearch.cluster.uuid": "tz-test-cluster" } } }

Release Note

Fix Stack Monitoring Recent Log Entries timestamps to respect Kibana's time zone setting (dateFormat:tz).

@kapral18 kapral18 requested a review from a team as a code owner January 14, 2026 13:52
@kapral18 kapral18 added Team:Monitoring Stack Monitoring team backport:all-open Backport to all branches that could still receive a release release_note:fix bug Fixes for quality problems that affect the customer experience labels Jan 14, 2026
Copy link
Contributor

@consulthys consulthys left a comment

Choose a reason for hiding this comment

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

LGT Stack Monitoring
Thank you very much for the changes 👍

return useUTC
? moment.utc(date).format('LL LTS')
: moment.tz(date, timezone || moment.tz.guess()).format('LL LTS');
export function formatDateTimeLocal(date: number | Date, timezone?: string | null): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

useUTC is removed because is no longer used anywhere

Copy link
Member

@pickypg pickypg left a comment

Choose a reason for hiding this comment

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

LGTM

@kapral18 kapral18 force-pushed the fix/stack-monitoring/fix-tz-in-recent-log-entries branch from 56ee6e1 to f1615c4 Compare January 14, 2026 19:25
Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

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

Code changes look good, work well!

…stamps

- Resolve dateFormat:tz values of Browser/null/unset to the guessed timezone
- Add unit tests to cover explicit, Browser, and default timezone behavior
@kapral18 kapral18 force-pushed the fix/stack-monitoring/fix-tz-in-recent-log-entries branch from f1615c4 to fc96d61 Compare January 14, 2026 21:23
@jbudz jbudz merged commit 67cefd4 into elastic:main Jan 14, 2026
12 of 13 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21011495089

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
Closes elastic#120292

## Summary
The Stack Monitoring **Recent Log Entries** table now respects the
Kibana `dateFormat:tz` advanced setting.

## Details
- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values of
`Browser`/`null`/unset as the browser-guessed timezone
- Keeps explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working as
expected
- Adds unit tests covering explicit timezone, `Browser`, and
default/unset behavior

## Demo

Current locale is UTC+1 (value should be 2:26)

### Before
<img width="1718" height="1407" alt="SCR-20260114-myjp"
src="https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868"
/>

### After
<img width="1720" height="1408" alt="SCR-20260114-mymj"
src="https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378"
/>

## Test plan
- `node scripts/jest
x-pack/platform/plugins/private/monitoring/common/formatting.test.ts`
- Manual: change **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp updates

## Manual test data (optional)
If you don't already have Stack Monitoring data available locally, you
can create a minimal set of documents via **Kibana → Dev Tools →
Console**.

Pick values for:
- `<ISO_TIMESTAMP>`: an ISO timestamp like `2026-01-14T16:07:52.324Z`
- `<EPOCH_MS>`: the same moment as epoch millis like `1768406872324`

Then run:

1) Create a minimal cluster stats doc (note the `timestamp` field):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "timestamp": <EPOCH_MS>,
  "type": "cluster_stats",
  "metricset": { "name": "cluster_stats" },
  "data_stream": { "type": "metrics", "dataset": "elasticsearch.stack_monitoring.cluster_stats", "namespace": "default" },
  "cluster_uuid": "tz-test-cluster",
  "cluster_name": "tz-test-cluster",
  "license": { "status": "active", "type": "trial", "expiry_date_in_millis": 1894665600000 }
}
```

2) Create a minimal Elasticsearch server log doc for the same cluster:

```http
POST logs-elasticsearch.server-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "message": "TZ regression test log entry - should show in browser timezone",
  "service": { "type": "elasticsearch" },
  "event": { "dataset": "elasticsearch.server" },
  "log": { "level": "INFO" },
  "elasticsearch": {
    "cluster": { "uuid": "tz-test-cluster" },
    "node": { "name": "test-node-1" },
    "component": "test-component"
  }
}
```

3) In Kibana:
- Set the time picker to a range that includes `<ISO_TIMESTAMP>` (e.g.
**Last 15 minutes** if you used “now - 5m”)
- Go to **Stack Monitoring → Elasticsearch → Overview** and confirm
**Recent Log Entries** shows the row
- Flip **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** between `Browser` and `UTC` and confirm the
displayed timestamp shifts accordingly

4) Cleanup (optional):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true
{ "query": { "term": { "cluster_uuid": "tz-test-cluster" } } }
```

```http
POST logs-elasticsearch.*-*/_delete_by_query?refresh=true
{ "query": { "term": { "elasticsearch.cluster.uuid": "tz-test-cluster" } } }
```

# Release Note
Fix Stack Monitoring Recent Log Entries timestamps to respect Kibana's
time zone setting (`dateFormat:tz`).

(cherry picked from commit 67cefd4)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
Closes elastic#120292

## Summary
The Stack Monitoring **Recent Log Entries** table now respects the
Kibana `dateFormat:tz` advanced setting.

## Details
- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values of
`Browser`/`null`/unset as the browser-guessed timezone
- Keeps explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working as
expected
- Adds unit tests covering explicit timezone, `Browser`, and
default/unset behavior

## Demo

Current locale is UTC+1 (value should be 2:26)

### Before
<img width="1718" height="1407" alt="SCR-20260114-myjp"
src="https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868"
/>

### After
<img width="1720" height="1408" alt="SCR-20260114-mymj"
src="https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378"
/>

## Test plan
- `node scripts/jest
x-pack/platform/plugins/private/monitoring/common/formatting.test.ts`
- Manual: change **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp updates

## Manual test data (optional)
If you don't already have Stack Monitoring data available locally, you
can create a minimal set of documents via **Kibana → Dev Tools →
Console**.

Pick values for:
- `<ISO_TIMESTAMP>`: an ISO timestamp like `2026-01-14T16:07:52.324Z`
- `<EPOCH_MS>`: the same moment as epoch millis like `1768406872324`

Then run:

1) Create a minimal cluster stats doc (note the `timestamp` field):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "timestamp": <EPOCH_MS>,
  "type": "cluster_stats",
  "metricset": { "name": "cluster_stats" },
  "data_stream": { "type": "metrics", "dataset": "elasticsearch.stack_monitoring.cluster_stats", "namespace": "default" },
  "cluster_uuid": "tz-test-cluster",
  "cluster_name": "tz-test-cluster",
  "license": { "status": "active", "type": "trial", "expiry_date_in_millis": 1894665600000 }
}
```

2) Create a minimal Elasticsearch server log doc for the same cluster:

```http
POST logs-elasticsearch.server-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "message": "TZ regression test log entry - should show in browser timezone",
  "service": { "type": "elasticsearch" },
  "event": { "dataset": "elasticsearch.server" },
  "log": { "level": "INFO" },
  "elasticsearch": {
    "cluster": { "uuid": "tz-test-cluster" },
    "node": { "name": "test-node-1" },
    "component": "test-component"
  }
}
```

3) In Kibana:
- Set the time picker to a range that includes `<ISO_TIMESTAMP>` (e.g.
**Last 15 minutes** if you used “now - 5m”)
- Go to **Stack Monitoring → Elasticsearch → Overview** and confirm
**Recent Log Entries** shows the row
- Flip **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** between `Browser` and `UTC` and confirm the
displayed timestamp shifts accordingly

4) Cleanup (optional):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true
{ "query": { "term": { "cluster_uuid": "tz-test-cluster" } } }
```

```http
POST logs-elasticsearch.*-*/_delete_by_query?refresh=true
{ "query": { "term": { "elasticsearch.cluster.uuid": "tz-test-cluster" } } }
```

# Release Note
Fix Stack Monitoring Recent Log Entries timestamps to respect Kibana's
time zone setting (`dateFormat:tz`).

(cherry picked from commit 67cefd4)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
Closes elastic#120292

## Summary
The Stack Monitoring **Recent Log Entries** table now respects the
Kibana `dateFormat:tz` advanced setting.

## Details
- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values of
`Browser`/`null`/unset as the browser-guessed timezone
- Keeps explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working as
expected
- Adds unit tests covering explicit timezone, `Browser`, and
default/unset behavior

## Demo

Current locale is UTC+1 (value should be 2:26)

### Before
<img width="1718" height="1407" alt="SCR-20260114-myjp"
src="https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868"
/>

### After
<img width="1720" height="1408" alt="SCR-20260114-mymj"
src="https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378"
/>

## Test plan
- `node scripts/jest
x-pack/platform/plugins/private/monitoring/common/formatting.test.ts`
- Manual: change **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp updates

## Manual test data (optional)
If you don't already have Stack Monitoring data available locally, you
can create a minimal set of documents via **Kibana → Dev Tools →
Console**.

Pick values for:
- `<ISO_TIMESTAMP>`: an ISO timestamp like `2026-01-14T16:07:52.324Z`
- `<EPOCH_MS>`: the same moment as epoch millis like `1768406872324`

Then run:

1) Create a minimal cluster stats doc (note the `timestamp` field):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "timestamp": <EPOCH_MS>,
  "type": "cluster_stats",
  "metricset": { "name": "cluster_stats" },
  "data_stream": { "type": "metrics", "dataset": "elasticsearch.stack_monitoring.cluster_stats", "namespace": "default" },
  "cluster_uuid": "tz-test-cluster",
  "cluster_name": "tz-test-cluster",
  "license": { "status": "active", "type": "trial", "expiry_date_in_millis": 1894665600000 }
}
```

2) Create a minimal Elasticsearch server log doc for the same cluster:

```http
POST logs-elasticsearch.server-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "message": "TZ regression test log entry - should show in browser timezone",
  "service": { "type": "elasticsearch" },
  "event": { "dataset": "elasticsearch.server" },
  "log": { "level": "INFO" },
  "elasticsearch": {
    "cluster": { "uuid": "tz-test-cluster" },
    "node": { "name": "test-node-1" },
    "component": "test-component"
  }
}
```

3) In Kibana:
- Set the time picker to a range that includes `<ISO_TIMESTAMP>` (e.g.
**Last 15 minutes** if you used “now - 5m”)
- Go to **Stack Monitoring → Elasticsearch → Overview** and confirm
**Recent Log Entries** shows the row
- Flip **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** between `Browser` and `UTC` and confirm the
displayed timestamp shifts accordingly

4) Cleanup (optional):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true
{ "query": { "term": { "cluster_uuid": "tz-test-cluster" } } }
```

```http
POST logs-elasticsearch.*-*/_delete_by_query?refresh=true
{ "query": { "term": { "elasticsearch.cluster.uuid": "tz-test-cluster" } } }
```

# Release Note
Fix Stack Monitoring Recent Log Entries timestamps to respect Kibana's
time zone setting (`dateFormat:tz`).

(cherry picked from commit 67cefd4)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
Closes elastic#120292

## Summary
The Stack Monitoring **Recent Log Entries** table now respects the
Kibana `dateFormat:tz` advanced setting.

## Details
- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values of
`Browser`/`null`/unset as the browser-guessed timezone
- Keeps explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working as
expected
- Adds unit tests covering explicit timezone, `Browser`, and
default/unset behavior

## Demo

Current locale is UTC+1 (value should be 2:26)

### Before
<img width="1718" height="1407" alt="SCR-20260114-myjp"
src="https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868"
/>

### After
<img width="1720" height="1408" alt="SCR-20260114-mymj"
src="https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378"
/>

## Test plan
- `node scripts/jest
x-pack/platform/plugins/private/monitoring/common/formatting.test.ts`
- Manual: change **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp updates

## Manual test data (optional)
If you don't already have Stack Monitoring data available locally, you
can create a minimal set of documents via **Kibana → Dev Tools →
Console**.

Pick values for:
- `<ISO_TIMESTAMP>`: an ISO timestamp like `2026-01-14T16:07:52.324Z`
- `<EPOCH_MS>`: the same moment as epoch millis like `1768406872324`

Then run:

1) Create a minimal cluster stats doc (note the `timestamp` field):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "timestamp": <EPOCH_MS>,
  "type": "cluster_stats",
  "metricset": { "name": "cluster_stats" },
  "data_stream": { "type": "metrics", "dataset": "elasticsearch.stack_monitoring.cluster_stats", "namespace": "default" },
  "cluster_uuid": "tz-test-cluster",
  "cluster_name": "tz-test-cluster",
  "license": { "status": "active", "type": "trial", "expiry_date_in_millis": 1894665600000 }
}
```

2) Create a minimal Elasticsearch server log doc for the same cluster:

```http
POST logs-elasticsearch.server-default/_doc?refresh=wait_for
{
  "@timestamp": "<ISO_TIMESTAMP>",
  "message": "TZ regression test log entry - should show in browser timezone",
  "service": { "type": "elasticsearch" },
  "event": { "dataset": "elasticsearch.server" },
  "log": { "level": "INFO" },
  "elasticsearch": {
    "cluster": { "uuid": "tz-test-cluster" },
    "node": { "name": "test-node-1" },
    "component": "test-component"
  }
}
```

3) In Kibana:
- Set the time picker to a range that includes `<ISO_TIMESTAMP>` (e.g.
**Last 15 minutes** if you used “now - 5m”)
- Go to **Stack Monitoring → Elasticsearch → Overview** and confirm
**Recent Log Entries** shows the row
- Flip **Stack Management → Advanced Settings → Time zone
(`dateFormat:tz`)** between `Browser` and `UTC` and confirm the
displayed timestamp shifts accordingly

4) Cleanup (optional):

```http
POST metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true
{ "query": { "term": { "cluster_uuid": "tz-test-cluster" } } }
```

```http
POST logs-elasticsearch.*-*/_delete_by_query?refresh=true
{ "query": { "term": { "elasticsearch.cluster.uuid": "tz-test-cluster" } } }
```

# Release Note
Fix Stack Monitoring Recent Log Entries timestamps to respect Kibana's
time zone setting (`dateFormat:tz`).

(cherry picked from commit 67cefd4)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kapral18 kapral18 deleted the fix/stack-monitoring/fix-tz-in-recent-log-entries branch January 14, 2026 22:21
@elasticmachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #20 / Cloud Security Posture POST /internal/cloud_security_posture/graph Happy flows Enrich graph with entity metadata should enrich graph with multiple targets from different fields with mixed grouping
  • [job] [logs] FTR Configs #20 / Cloud Security Posture Verify update csp rules states API verify new rules are added and existing rules are set.

History

kibanamachine added a commit that referenced this pull request Jan 15, 2026
…249115)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Stack Monitoring] Fix Recent Log Entries timezone
(#249016)](#249016)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-01-14T22:03:31Z","message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Monitoring","backport:all-open","v9.4.0"],"title":"[Stack
Monitoring] Fix Recent Log Entries
timezone","number":249016,"url":"https://github.com/elastic/kibana/pull/249016","mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/249016","number":249016,"mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 15, 2026
…249113)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Stack Monitoring] Fix Recent Log Entries timezone
(#249016)](#249016)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-01-14T22:03:31Z","message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Monitoring","backport:all-open","v9.4.0"],"title":"[Stack
Monitoring] Fix Recent Log Entries
timezone","number":249016,"url":"https://github.com/elastic/kibana/pull/249016","mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/249016","number":249016,"mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 15, 2026
…249114)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Stack Monitoring] Fix Recent Log Entries timezone
(#249016)](#249016)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-01-14T22:03:31Z","message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Monitoring","backport:all-open","v9.4.0"],"title":"[Stack
Monitoring] Fix Recent Log Entries
timezone","number":249016,"url":"https://github.com/elastic/kibana/pull/249016","mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/249016","number":249016,"mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 15, 2026
…249112)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Stack Monitoring] Fix Recent Log Entries timezone
(#249016)](#249016)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-01-14T22:03:31Z","message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Monitoring","backport:all-open","v9.4.0"],"title":"[Stack
Monitoring] Fix Recent Log Entries
timezone","number":249016,"url":"https://github.com/elastic/kibana/pull/249016","mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/249016","number":249016,"mergeCommit":{"message":"[Stack
Monitoring] Fix Recent Log Entries timezone (#249016)\n\nCloses
#120292\n\n## Summary\nThe Stack Monitoring **Recent Log Entries** table
now respects the\nKibana `dateFormat:tz` advanced setting.\n\n##
Details\n- Fixes `formatDateTimeLocal` to treat `dateFormat:tz` values
of\n`Browser`/`null`/unset as the browser-guessed timezone\n- Keeps
explicit timezone values (e.g. `UTC`, `Asia/Seoul`) working
as\nexpected\n- Adds unit tests covering explicit timezone, `Browser`,
and\ndefault/unset behavior\n\n## Demo\n\nCurrent locale is UTC+1 (value
should be 2:26)\n\n### Before\n<img width=\"1718\" height=\"1407\"
alt=\"SCR-20260114-myjp\"\nsrc=\"https://github.com/user-attachments/assets/18659259-1fe1-4341-a5ce-66593bbad868\"\n/>\n\n###
After\n<img width=\"1720\" height=\"1408\"
alt=\"SCR-20260114-mymj\"\nsrc=\"https://github.com/user-attachments/assets/db5f5b96-5671-428f-8992-7bd017ce8378\"\n/>\n\n\n##
Test plan\n- `node
scripts/jest\nx-pack/platform/plugins/private/monitoring/common/formatting.test.ts`\n-
Manual: change **Stack Management → Advanced Settings → Time
zone\n(`dateFormat:tz`)** and confirm the Recent Log Entries timestamp
updates\n\n## Manual test data (optional)\nIf you don't already have
Stack Monitoring data available locally, you\ncan create a minimal set
of documents via **Kibana → Dev Tools →\nConsole**.\n\nPick values
for:\n- `<ISO_TIMESTAMP>`: an ISO timestamp like
`2026-01-14T16:07:52.324Z`\n- `<EPOCH_MS>`: the same moment as epoch
millis like `1768406872324`\n\nThen run:\n\n1) Create a minimal cluster
stats doc (note the `timestamp` field):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"timestamp\": <EPOCH_MS>,\n
\"type\": \"cluster_stats\",\n \"metricset\": { \"name\":
\"cluster_stats\" },\n \"data_stream\": { \"type\": \"metrics\",
\"dataset\": \"elasticsearch.stack_monitoring.cluster_stats\",
\"namespace\": \"default\" },\n \"cluster_uuid\": \"tz-test-cluster\",\n
\"cluster_name\": \"tz-test-cluster\",\n \"license\": { \"status\":
\"active\", \"type\": \"trial\", \"expiry_date_in_millis\":
1894665600000 }\n}\n```\n\n2) Create a minimal Elasticsearch server log
doc for the same cluster:\n\n```http\nPOST
logs-elasticsearch.server-default/_doc?refresh=wait_for\n{\n
\"@timestamp\": \"<ISO_TIMESTAMP>\",\n \"message\": \"TZ regression test
log entry - should show in browser timezone\",\n \"service\": {
\"type\": \"elasticsearch\" },\n \"event\": { \"dataset\":
\"elasticsearch.server\" },\n \"log\": { \"level\": \"INFO\" },\n
\"elasticsearch\": {\n \"cluster\": { \"uuid\": \"tz-test-cluster\" },\n
\"node\": { \"name\": \"test-node-1\" },\n \"component\":
\"test-component\"\n }\n}\n```\n\n3) In Kibana:\n- Set the time picker
to a range that includes `<ISO_TIMESTAMP>` (e.g.\n**Last 15 minutes** if
you used “now - 5m”)\n- Go to **Stack Monitoring → Elasticsearch →
Overview** and confirm\n**Recent Log Entries** shows the row\n- Flip
**Stack Management → Advanced Settings → Time zone\n(`dateFormat:tz`)**
between `Browser` and `UTC` and confirm the\ndisplayed timestamp shifts
accordingly\n\n4) Cleanup (optional):\n\n```http\nPOST
metrics-elasticsearch.stack_monitoring.cluster_stats-default/_delete_by_query?refresh=true\n{
\"query\": { \"term\": { \"cluster_uuid\": \"tz-test-cluster\" } }
}\n```\n\n```http\nPOST
logs-elasticsearch.*-*/_delete_by_query?refresh=true\n{ \"query\": {
\"term\": { \"elasticsearch.cluster.uuid\": \"tz-test-cluster\" } }
}\n```\n\n# Release Note\nFix Stack Monitoring Recent Log Entries
timestamps to respect Kibana's\ntime zone setting
(`dateFormat:tz`).","sha":"67cefd4473e660c08caa2d8562fd3e730784fdc8"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release bug Fixes for quality problems that affect the customer experience release_note:fix Team:Monitoring Stack Monitoring team v8.19.11 v9.1.11 v9.2.5 v9.3.0 v9.4.0

7 participants