Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(dashboards): add recent logs widget (#64416)

Matt Pua6eb0e55698a8
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 7dc49fbe747b..4b3f29474b12 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -1769,9 +1769,9 @@ snapshots:
components-verticalnesteddnd--base--light:
hash: v1.k794b7964.b210ce352a085f9ed57aed4675cc78d23db5d2312f276ec790040b2ce27e293a.duU6Lgj4ID4h_Qo76s2bErUZYu2IuRIHoy4D7_tCGT4
dashboards-dashboard-widgets-overview--all-widget-types--dark:
- hash: v1.k794b7964.afac6daacd209c9756ac18f4d550450c28cd0796ab3e0d2f81f8730e033132ea.o1IvcXj0C0otWKihcqxykKFKG0OUxCWvqNq6IJJMCjI
+ hash: v1.k794b7964.e86ceb254b401c489ab99a971210ae6fcff0e47bb7eb512daf896b47fc2473d7.gdReADxQa9J9TbRINl5Oyg7NSoRwOfgdP_20x6IXN9I
dashboards-dashboard-widgets-overview--all-widget-types--light:
- hash: v1.k794b7964.f32b343aa7fcaabf6767b6c533d85b40f8b7a3cc1b9d80fe7d2253859a890ad5.VQg2i7X9FGt-fh-vmxr027ufi0Bnkg7BmQAhOtTXqgs
+ hash: v1.k794b7964.ce4054465ab9e06e075e861a445d1b9ef950b0b8daf695d96c861b35e2a879e9.b-JT0h-0O_q3tb2zrAFJrbj-0TDVU2X9oqsO59LA25A
dashboards-dashboard-widgets-widget-types-activity-recent-events--default--dark:
hash: v1.k794b7964.efdbea5790ee8e35bd2ae969acc32686edd47bf2990008fcd3d6f572f309f18b.4ZbAHTXiE7te8-Ck6clsY28Y5-JOOCpIPfSguR6E4Es
dashboards-dashboard-widgets-widget-types-activity-recent-events--default--light:
@@ -1856,6 +1856,26 @@ snapshots:
hash: v1.k794b7964.36c039ca5a5530ad1271f73bdf22b34554ed93496949ea1488b16a14bb5ba029.j7gTAPQ3J8pdVisoXvSHDUgS8Kl5vlBmF9hU3VnCw0o
dashboards-dashboard-widgets-widget-types-experiments-experiments-widget-settings--default--light:
hash: v1.k794b7964.8715a7b54c54caeceabc7ada435074e73e2b0b3d8bada7d9f7f53e56b305d815.BNfFt-AV0Y6mZeXlQVNA3CZrm_kkfncCe-uU5dvbTg4
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--default--dark:
+ hash: v1.k794b7964.0f9312239687a9841e3a64d86b072b5ea99b03544c49e9d6959c19d0c6135162.bdT9uvy9Tpxue_rUFh8nJ7Ht06Y-SWetkkZUmoXJ3Gk
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--default--light:
+ hash: v1.k794b7964.d4505c8d16a7c0bdd66bda95ccd49d5b65838ed13b2e043f72d60ce23d9a6031.cVx0ytD0TowHR2xwDsaLcJ1EW0cMcLJV7xsrQwyK_LE
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--empty--dark:
+ hash: v1.k794b7964.0ec7815aa88b420d9292711daae7973abb744c5eab0639178a1b41e8b58f5797.Q_34NDcflyV4tsqYZDK3vrElY8lfZ6Jy1CBuTQFeEwM
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--empty--light:
+ hash: v1.k794b7964.42ae3df5188a34f09e4b50009422baa5d7c4a85e3226de4b89bc434cd3a74dfa.X2tXR6LYJpYINithLSzgFNB6x1vAN4kL0BAddXdUmfc
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--loading--dark:
+ hash: v1.k794b7964.954f969df71e68210eb28e790cafcfd9dbb84fb5e2e495164c2386b3fe144683.U8q83nj5C-RGsXMPyJx1WYKJ1N7kT5EaBrLxFS0WC4I
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--loading--light:
+ hash: v1.k794b7964.0ba9a8683302da2288af83e44f00621c301935816f523b190d1133f4769da27e.yP1oU56Kp7xpJib9MkFxPpn6imDc6BBOlffzkvgaxcE
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--tile-filters-read-only--dark:
+ hash: v1.k794b7964.38714458c55dd6d9fc7e760b4b06b672112db46ea7a7745ab2e1fec513b76962.CF6vEIevd4YEVIQzekjrOFs1_KzfpQdIwa3ZblHxPmU
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs--tile-filters-read-only--light:
+ hash: v1.k794b7964.735d0ceb3593450c3d187506dadd86468152e877d2c46d53598f1eb46bb22416.wVPvAIkuFdBzcx8YtfmAI-IsVZa6GOm7_k-HUndD80g
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs-widget-settings--default--dark:
+ hash: v1.k794b7964.86d586185cb4e94b369d945f2561a9ae8259114cecd98c84100b5151ea716790.8_30Xs68L3gsplLfCW2buncUGpbweXOwVUrHx6NnlmM
+ dashboards-dashboard-widgets-widget-types-logs-recent-logs-widget-settings--default--light:
+ hash: v1.k794b7964.0759c3c3f60e858fa3d4632b3bcaf50aeda25b8f0fd7913b118f40c213c22d83.7hKsAP4ErvrMc_UgRY6Fl3OBdnqlGd-m1_5BnEjGVoI
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--default--dark:
hash: v1.k794b7964.80be8d5bc3bc852e53b6e261dd0baa6056f58f279f47ee47a90d6f1fa532ce3e.80W_kUIy8SCKVA9dBxabCGnYkR338yx0ry-UHYCpaVE
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--default--light:
diff --git a/frontend/src/lib/utils/timezones.ts b/frontend/src/lib/utils/timezones.ts
index 756ebf9828c6..3a6e3adae0e0 100644
--- a/frontend/src/lib/utils/timezones.ts
+++ b/frontend/src/lib/utils/timezones.ts
@@ -21,6 +21,11 @@ export function shortTimeZone(timeZone?: string, atDate?: Date): string | null {
}
}
+/** The viewer's own IANA timezone (e.g. 'America/New_York'), as resolved by the browser. */
+export function getLocalTimeZone(): string {
+ return Intl.DateTimeFormat().resolvedOptions().timeZone
+}
+
export function timeZoneLabel(timeZone: string, offset: number): string {
const formattedZone = timeZone.replace(/\//g, ' / ').replace(/_/g, ' ')
const sign = offset === 0 ? '±' : offset > 0 ? '+' : '-'
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 4498c8709a4c..6fd1f74ff230 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -614,6 +614,7 @@ SPECTACULAR_SETTINGS = {
"SessionReplayListWidgetTypeEnum": ["session_replay_list"],
"ExperimentsListWidgetTypeEnum": ["experiments_list"],
"ExperimentResultsWidgetTypeEnum": ["experiment_results"],
+ "LogsListWidgetTypeEnum": ["logs_list"],
"OrderByEnum": ["latest", "earliest"],
"PropertyGroupTypeEnum": ["cohort", "person", "group"],
"ExistenceOperatorEnum": ["is_set", "is_not_set"],
diff --git a/products/dashboards/backend/api/test/test_run_widgets.py b/products/dashboards/backend/api/test/test_run_widgets.py
index c7e6989b4b82..cdc02fa56f7d 100644
--- a/products/dashboards/backend/api/test/test_run_widgets.py
+++ b/products/dashboards/backend/api/test/test_run_widgets.py
@@ -29,6 +29,8 @@ from products.dashboards.backend.constants import (
ACTIVITY_EVENTS_DEFAULT_LIMIT,
ACTIVITY_EVENTS_MAX_LIMIT,
DEFAULT_WIDGET_LIST_LIMIT,
+ LOGS_LIST_DEFAULT_LIMIT,
+ LOGS_LIST_MAX_LIMIT,
MAX_WIDGET_RESULT_LIMIT,
MAX_WIDGETS_BATCH_SIZE,
)
@@ -37,6 +39,7 @@ from products.dashboards.backend.widget_registry import EXPECTED_WIDGET_TYPES, W
from products.dashboards.backend.widget_specs.configs import (
ACTIVITY_EVENTS_LIST_WIDGET_TYPE,
ERROR_TRACKING_LIST_WIDGET_TYPE,
+ LOGS_LIST_WIDGET_TYPE,
SESSION_REPLAY_LIST_WIDGET_TYPE,
ErrorTrackingListWidgetConfig,
SessionReplayOrderBy,
@@ -47,8 +50,10 @@ from products.dashboards.backend.widgets.activity_events_list import (
run_activity_events_list_widget,
)
from products.dashboards.backend.widgets.error_tracking_list import run_error_tracking_list_widget
+from products.dashboards.backend.widgets.logs_list import run_logs_list_widget
from products.dashboards.backend.widgets.session_replay_list import run_session_replay_list_widget
from products.error_tracking.backend.facade.query_utils import ERROR_TRACKING_LISTING_VOLUME_RESOLUTION
+from products.logs.backend.models import LogsView
class TestWidgetRegistry(APIBaseTest):
@@ -90,6 +95,42 @@ class TestWidgetRegistry(APIBaseTest):
assert validated["orderBy"] == default_order_by
assert "filterTestAccounts" not in validated
+ def test_validate_logs_list_config_defaults(self) -> None:
+ # Logs has its own larger page than other list widgets.
+ validated = validate_widget_config(LOGS_LIST_WIDGET_TYPE, {})
+ assert validated["limit"] == LOGS_LIST_DEFAULT_LIMIT
+ assert validated["orderBy"] == "latest"
+ assert validated["wrapLines"] is False
+ assert validated["timezone"] == "UTC"
+ assert "savedViewId" not in validated
+ assert "filterTestAccounts" not in validated
+
+ @parameterized.expand(
+ [
+ ("invalid_order_by", {"orderBy": "not_a_field"}),
+ ("invalid_severity_level", {"severityLevels": ["not_a_level"]}),
+ ("invalid_timezone", {"timezone": "America/New_York"}),
+ ("invalid_saved_view_id", {"savedViewId": 123}),
+ ]
+ )
+ def test_validate_logs_list_config_rejects_invalid_values(self, _label: str, config: dict) -> None:
+ with self.assertRaises(Exception):
+ validate_widget_config(LOGS_LIST_WIDGET_TYPE, config)
+
+ def test_validate_logs_list_config_accepts_severity_and_services(self) -> None:
+ validated = validate_widget_config(
+ LOGS_LIST_WIDGET_TYPE,
+ {"severityLevels": ["error", "warn"], "serviceNames": ["api", "web"], "orderBy": "earliest"},
+ )
+ assert validated["severityLevels"] == ["error", "warn"]
+ assert validated["serviceNames"] == ["api", "web"]
+ assert validated["orderBy"] == "earliest"
+
+ def test_validate_logs_list_config_rejects_test_account_filter(self) -> None:
+ # Logs queries have no test-account concept, so the field must not be accepted.
+ with self.assertRaises(Exception):
+ validate_widget_config(LOGS_LIST_WIDGET_TYPE, cast(dict[str, object], {"filterTestAccounts": True}))
+
def test_validate_activity_events_list_config_defaults(self) -> None:
validated = validate_widget_config(ACTIVITY_EVENTS_LIST_WIDGET_TYPE, {})
assert validated["limit"] == ACTIVITY_EVENTS_DEFAULT_LIMIT
@@ -129,10 +170,28 @@ class TestWidgetRegistry(APIBaseTest):
with self.assertRaises(Exception):
validate_widget_config(widget_type, {"limit": 100})
+ def test_validate_logs_list_config_accepts_limit_up_to_max(self) -> None:
+ validated = validate_widget_config(LOGS_LIST_WIDGET_TYPE, {"limit": LOGS_LIST_MAX_LIMIT})
+ assert validated["limit"] == LOGS_LIST_MAX_LIMIT
+
+ def test_validate_logs_list_config_rejects_limit_above_max(self) -> None:
+ with self.assertRaises(Exception):
+ validate_widget_config(LOGS_LIST_WIDGET_TYPE, {"limit": LOGS_LIST_MAX_LIMIT + 1})
+
+ def test_validate_logs_list_config_accepts_display_and_saved_view(self) -> None:
+ validated = validate_widget_config(
+ LOGS_LIST_WIDGET_TYPE,
+ {"wrapLines": True, "timezone": "local", "savedViewId": "abc123"},
+ )
+ assert validated["wrapLines"] is True
+ assert validated["timezone"] == "local"
+ assert validated["savedViewId"] == "abc123"
+
@parameterized.expand(
[("activity_events", ACTIVITY_EVENTS_LIST_WIDGET_TYPE, date_from) for date_from in ["-1h", "-3h", "-24h"]]
+ [("error_tracking", ERROR_TRACKING_LIST_WIDGET_TYPE, date_from) for date_from in ["-1h", "-3h", "-24h"]]
+ [("session_replay", SESSION_REPLAY_LIST_WIDGET_TYPE, date_from) for date_from in ["-1h", "-3h", "-24h"]]
+ + [("logs", LOGS_LIST_WIDGET_TYPE, date_from) for date_from in ["-1h", "-3h", "-24h"]]
)
def test_validate_list_config_accepts_short_date_ranges(
self, _label: str, widget_type: str, date_from: str
@@ -148,6 +207,7 @@ class TestWidgetRegistry(APIBaseTest):
("activity_events", ACTIVITY_EVENTS_LIST_WIDGET_TYPE),
("error_tracking", ERROR_TRACKING_LIST_WIDGET_TYPE),
("session_replay", SESSION_REPLAY_LIST_WIDGET_TYPE),
+ ("logs", LOGS_LIST_WIDGET_TYPE),
]
)
def test_validate_list_config_rejects_unsupported_date_range(self, _label: str, widget_type: str) -> None:
@@ -162,6 +222,7 @@ class TestWidgetRegistry(APIBaseTest):
("activity_events", ACTIVITY_EVENTS_LIST_WIDGET_TYPE),
("error_tracking", ERROR_TRACKING_LIST_WIDGET_TYPE),
("session_replay", SESSION_REPLAY_LIST_WIDGET_TYPE),
+ ("logs", LOGS_LIST_WIDGET_TYPE),
]
)
def test_validate_list_config_strips_unknown_date_range_keys(self, _label: str, widget_type: str) -> None:
@@ -352,8 +413,130 @@ class TestDashboardRunWidgets(APIBaseTest):
self.assertEqual(query.select, ACTIVITY_EVENTS_WIDGET_SELECT)
self.assertEqual(query.orderBy, ["timestamp DESC"])
self.assertEqual(query.after, "-24h")
+
+ @patch("products.dashboards.backend.widgets.logs_list.LogsQueryRunner")
+ def test_runs_logs_widget_for_requested_tile(self, mock_runner_cls: MagicMock) -> None:
+ log_row = {
+ "uuid": "0196e9ab-0000-0000-0000-000000000000",
+ "timestamp": "2026-05-26T08:00:00Z",
+ "severity_text": "error",
+ "level": "error",
+ "body": "Boom",
+ "trace_id": "abc123",
+ }
+ mock_runner_cls.return_value.calculate.return_value = MagicMock(
+ model_dump=lambda mode="json": {"results": [log_row], "hasMore": False}
+ )
+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dash"})
+ _, dashboard_json = self.dashboard_api.create_widget_tile(
+ dashboard_id,
+ widget_type="logs_list",
+ config={
+ "limit": 10,
+ "severityLevels": ["error"],
+ "serviceNames": ["api"],
+ "orderBy": "earliest",
+ },
+ )
+ tile_id = dashboard_json["tiles"][0]["id"]
+
+ body = self._run(dashboard_id, [tile_id])
+
+ self.assertEqual(len(body["results"]), 1)
+ self.assertEqual(body["results"][0]["tile_id"], tile_id)
+ self.assertEqual(body["results"][0]["widget_type"], LOGS_LIST_WIDGET_TYPE)
+ self.assertIsNone(body["results"][0]["error"])
+ result = body["results"][0]["result"]
+ self.assertEqual(result["limit"], 10)
+ self.assertEqual(result["results"][0], log_row)
+ self.assertEqual(result["totalCount"], 1)
+ self.assertFalse(result["totalCountCapped"])
+ mock_runner_cls.assert_called_once()
+ query = mock_runner_cls.call_args.kwargs["query"]
+ self.assertEqual(query.orderBy, "earliest")
+ self.assertEqual(query.severityLevels, ["error"])
+ self.assertEqual(query.serviceNames, ["api"])
+ self.assertTrue(query.excludeAttributes)
self.assertEqual(query.limit, 10)
+ @patch("products.dashboards.backend.widgets.logs_list.LogsQueryRunner")
+ def test_runs_logs_widget_with_saved_view(self, mock_runner_cls: MagicMock) -> None:
+ mock_runner_cls.return_value.calculate.return_value = MagicMock(
+ model_dump=lambda mode="json": {"results": [], "hasMore": False}
+ )
+ view = LogsView.objects.create(
+ team=self.team,
+ name="My view",
+ filters={
+ "severityLevels": ["warn"],
+ "serviceNames": ["worker"],
+ "searchTerm": "timeout",
+ "dateRange": {"date_from": "-3h", "date_to": None},
+ },
+ )
+ # Run the widget in-process: the run_widgets endpoint dispatches to a thread pool whose
+ # DB connection can't see the LogsView created in this test's (uncommitted) transaction.
+ run_logs_list_widget(
+ self.team,
+ {
+ "limit": 20,
+ "orderBy": "earliest",
+ "savedViewId": view.short_id,
+ # These are ignored once a saved view is selected — the view owns them.
+ "severityLevels": ["error"],
+ "serviceNames": ["api"],
+ },
+ user=self.user,
+ )
+
+ query = mock_runner_cls.call_args.kwargs["query"]
+ self.assertEqual(query.severityLevels, ["warn"])
+ self.assertEqual(query.serviceNames, ["worker"])
+ self.assertEqual(query.searchTerm, "timeout")
+ # Widget still owns sort + page size.
+ self.assertEqual(query.orderBy, "earliest")
+ self.assertEqual(query.limit, 20)
+
+ @patch("products.dashboards.backend.widgets.logs_list.LogsQueryRunner")
+ def test_runs_logs_widget_falls_back_when_saved_view_missing(self, mock_runner_cls: MagicMock) -> None:
+ mock_runner_cls.return_value.calculate.return_value = MagicMock(
+ model_dump=lambda mode="json": {"results": [], "hasMore": False}
+ )
+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dash"})
+ _, dashboard_json = self.dashboard_api.create_widget_tile(
+ dashboard_id,
+ widget_type="logs_list",
+ config={"limit": 15, "orderBy": "latest", "savedViewId": "missing", "severityLevels": ["error"]},
+ )
+ tile_id = dashboard_json["tiles"][0]["id"]
+
+ self._run(dashboard_id, [tile_id])
+
+ # Unknown view falls back to the widget's own config rather than erroring.
+ query = mock_runner_cls.call_args.kwargs["query"]
+ self.assertEqual(query.severityLevels, ["error"])
+ self.assertEqual(query.limit, 15)
+
+ @patch("products.dashboards.backend.widgets.logs_list.LogsQueryRunner")
+ def test_runs_logs_widget_falls_back_when_saved_view_filters_invalid(self, mock_runner_cls: MagicMock) -> None:
+ mock_runner_cls.return_value.calculate.return_value = MagicMock(
+ model_dump=lambda mode="json": {"results": [], "hasMore": False}
+ )
+ # `filters` has no inner schema validation on write, so a stored level outside the enum is possible.
+ view = LogsView.objects.create(team=self.team, name="Bad view", filters={"severityLevels": ["critical"]})
+
+ # In-process so the lookup sees the view (see test_runs_logs_widget_with_saved_view). A malformed
+ # view degrades to the widget's own config rather than raising.
+ run_logs_list_widget(
+ self.team,
+ {"limit": 12, "orderBy": "latest", "savedViewId": view.short_id, "severityLevels": ["warn"]},
+ user=self.user,
+ )
+
+ query = mock_runner_cls.call_args.kwargs["query"]
+ self.assertEqual(query.severityLevels, ["warn"])
+ self.assertEqual(query.limit, 12)
+
@patch("products.dashboards.backend.widgets.activity_events_list.EventsQueryRunner")
def test_activity_events_widget_applies_date_range_and_widget_filters(self, mock_runner_cls: MagicMock) -> None:
mock_runner_cls.return_value.calculate.return_value = MagicMock(
diff --git a/products/dashboards/backend/api/test/test_widget_config_schema_parity.py b/products/dashboards/backend/api/test/test_widget_config_schema_parity.py
index 5481768c26a0..2d40254a4dc6 100644
--- a/products/dashboards/backend/api/test/test_widget_config_schema_parity.py
+++ b/products/dashboards/backend/api/test/test_widget_config_schema_parity.py
@@ -4,15 +4,18 @@ from products.dashboards.backend.constants import (
ACTIVITY_EVENTS_DEFAULT_LIMIT,
ACTIVITY_EVENTS_MAX_LIMIT,
DEFAULT_WIDGET_LIST_LIMIT,
+ LOGS_LIST_DEFAULT_LIMIT,
+ LOGS_LIST_MAX_LIMIT,
MAX_WIDGET_RESULT_LIMIT,
)
from products.dashboards.backend.widget_catalog import WIDGET_CATALOG
-from products.dashboards.backend.widget_specs.configs import ACTIVITY_EVENTS_LIST_WIDGET_TYPE
+from products.dashboards.backend.widget_specs.configs import ACTIVITY_EVENTS_LIST_WIDGET_TYPE, LOGS_LIST_WIDGET_TYPE
from products.dashboards.backend.widget_specs.registry import WIDGET_SPECS
-# Activity events allows a larger page than other list widgets; other types share the default bounds.
+# Activity events and logs allow a larger page than other list widgets; other types share the default bounds.
WIDGET_LIMIT_BOUNDS = {
ACTIVITY_EVENTS_LIST_WIDGET_TYPE: (ACTIVITY_EVENTS_MAX_LIMIT, ACTIVITY_EVENTS_DEFAULT_LIMIT),
+ LOGS_LIST_WIDGET_TYPE: (LOGS_LIST_MAX_LIMIT, LOGS_LIST_DEFAULT_LIMIT),
}
diff --git a/products/dashboards/backend/constants.py b/products/dashboards/backend/constants.py
index 457205fd8468..70b42c50f260 100644
--- a/products/dashboards/backend/constants.py
+++ b/products/dashboards/backend/constants.py
@@ -11,6 +11,10 @@ DEFAULT_WIDGET_LIST_LIMIT = 10
ACTIVITY_EVENTS_MAX_LIMIT = 50
ACTIVITY_EVENTS_DEFAULT_LIMIT = 25
+# Logs list allows the largest page — log rows are cheap and users scan many at once.
+LOGS_LIST_MAX_LIMIT = 100
+LOGS_LIST_DEFAULT_LIMIT = 50
+
# Cap widgets per batch create / run-widgets request.
MAX_WIDGETS_BATCH_SIZE = 10
diff --git a/products/dashboards/backend/widget_specs/common.py b/products/dashboards/backend/widget_specs/common.py
index 05054689d98a..ae7874a110f7 100644
--- a/products/dashboards/backend/widget_specs/common.py
+++ b/products/dashboards/backend/widget_specs/common.py
@@ -8,6 +8,7 @@ from posthog.schema import PropertyOperator
from products.dashboards.backend.constants import (
ACTIVITY_EVENTS_MAX_LIMIT,
+ LOGS_LIST_MAX_LIMIT,
MAX_WIDGET_RESULT_LIMIT,
WIDGET_DATE_FROM_VALUES_ORDERED,
)
@@ -54,10 +55,28 @@ def validate_widget_filters_map(
return widget_filters
-class WidgetListConfigBase(BaseModel):
+class WidgetDateRangeConfigBase(BaseModel):
+ """Shared base for widgets that accept a preset date range but not the full list-filter set."""
+
model_config = ConfigDict(extra="forbid")
dateRange: WidgetDateRange | None = None
+
+ @field_validator("dateRange", mode="before")
+ @classmethod
+ def validate_date_range(cls, value: object) -> WidgetDateRange | None:
+ if value is None:
+ return None
+ if not isinstance(value, dict):
+ raise ValueError("dateRange must be an object.")
+ date_from = value.get("date_from")
+ if date_from is not None and (not isinstance(date_from, str) or date_from not in WIDGET_DATE_FROM_VALUES):
+ allowed = ", ".join(sorted(WIDGET_DATE_FROM_VALUES))
+ raise ValueError(f"dateRange.date_from must be one of: {allowed}.")
+ return WidgetDateRange(date_from=date_from)
+
+
+class WidgetListConfigBase(WidgetDateRangeConfigBase):
filterTestAccounts: bool | None = None
widgetFilters: dict[str, WidgetFilterEntry] | None = None
@@ -75,19 +94,7 @@ class WidgetListConfigBase(BaseModel):
def validate_widget_filters(cls, value: dict[str, WidgetFilterEntry] | None) -> dict[str, WidgetFilterEntry] | None:
return validate_widget_filters_map(value)
- @field_validator("dateRange", mode="before")
- @classmethod
- def validate_date_range(cls, value: object) -> WidgetDateRange | None:
- if value is None:
- return None
- if not isinstance(value, dict):
- raise ValueError("dateRange must be an object.")
- date_from = value.get("date_from")
- if date_from is not None and (not isinstance(date_from, str) or date_from not in WIDGET_DATE_FROM_VALUES):
- allowed = ", ".join(sorted(WIDGET_DATE_FROM_VALUES))
- raise ValueError(f"dateRange.date_from must be one of: {allowed}.")
- return WidgetDateRange(date_from=date_from)
-
WidgetLimit = Annotated[int, Field(ge=1, le=MAX_WIDGET_RESULT_LIMIT)]
ActivityWidgetLimit = Annotated[int, Field(ge=1, le=ACTIVITY_EVENTS_MAX_LIMIT)]
+LogsWidgetLimit = Annotated[int, Field(ge=1, le=LOGS_LIST_MAX_LIMIT)]
diff --git a/products/dashboards/backend/widget_specs/configs.py b/products/dashboards/backend/widget_specs/configs.py
index f35b2b8210b4..f4a63878df4d 100644
--- a/products/dashboards/backend/widget_specs/configs.py
+++ b/products/dashboards/backend/widget_specs/configs.py
@@ -4,9 +4,15 @@ from typing import Literal
from pydantic import BaseModel, ConfigDict, Field, field_validator
-from products.dashboards.backend.constants import ACTIVITY_EVENTS_DEFAULT_LIMIT, DEFAULT_WIDGET_LIST_LIMIT
+from products.dashboards.backend.constants import (
+ ACTIVITY_EVENTS_DEFAULT_LIMIT,
+ DEFAULT_WIDGET_LIST_LIMIT,
+ LOGS_LIST_DEFAULT_LIMIT,
+)
from products.dashboards.backend.widget_specs.common import (
ActivityWidgetLimit,
+ LogsWidgetLimit,
+ WidgetDateRangeConfigBase,
WidgetLimit,
WidgetListConfigBase,
WidgetOrderDirection,
@@ -17,6 +23,7 @@ ERROR_TRACKING_LIST_WIDGET_TYPE = "error_tracking_list"
SESSION_REPLAY_LIST_WIDGET_TYPE = "session_replay_list"
EXPERIMENTS_LIST_WIDGET_TYPE = "experiments_list"
EXPERIMENT_RESULTS_WIDGET_TYPE = "experiment_results"
+LOGS_LIST_WIDGET_TYPE = "logs_list"
ErrorTrackingOrderBy = Literal["last_seen", "first_seen", "occurrences", "users", "sessions"]
ErrorTrackingWidgetStatus = Literal["archived", "active", "resolved", "pending_release", "suppressed", "all"]
@@ -26,6 +33,11 @@ SessionReplayOrderBy = Literal[
WidgetAssigneeType = Literal["user", "role"]
ExperimentsWidgetStatus = Literal["draft", "running", "paused", "stopped", "all"]
ExperimentsWidgetOrderBy = Literal["created_at", "name", "start_date"]
+# Matches the logs scene: `earliest` sorts ascending by timestamp, `latest` (default) descending.
+LogsOrderBy = Literal["latest", "earliest"]
+LogSeverityLevel = Literal["trace", "debug", "info", "warn", "error", "fatal"]
+# How log timestamps render on the tile: in UTC, or in each viewer's local timezone.
+LogsTimezone = Literal["UTC", "local"]
class WidgetAssigneeFilter(BaseModel):
@@ -107,3 +119,42 @@ class ExperimentResultsWidgetConfig(BaseModel):
default=None,
description="Experiment to show results for. Null until the user picks one in the widget settings.",
)
+
+
+class LogsListWidgetConfig(WidgetDateRangeConfigBase):
+ limit: LogsWidgetLimit = Field(
+ default=LOGS_LIST_DEFAULT_LIMIT, description="Maximum number of log lines to return."
+ )
+ orderBy: LogsOrderBy = Field(default="latest", description="Sort by newest (latest) or oldest (earliest) first.")
+ severityLevels: list[LogSeverityLevel] = Field(
+ default_factory=list,
+ description="Only show logs at these severity levels. Empty shows all levels.",
+ )
+ serviceNames: list[str] = Field(
+ default_factory=list,
+ description="Only show logs from these services. Empty shows all services.",
+ )
+ wrapLines: bool = Field(
+ default=False,
+ description="Wrap long log lines instead of truncating them to a single row.",
+ )
+ timezone: LogsTimezone = Field(
+ default="UTC",
+ description="Render log timestamps in UTC or in each viewer's local timezone.",
+ )
+ savedViewId: str | None = Field(
+ default=None,
+ description=(
+ "short_id of a saved logs view to use as the source. When set, the saved view owns the date range, "
+ "severity, service, and property filters; only orderBy and limit still apply."
+ ),
+ )
+
+ @field_validator("savedViewId", mode="before")
+ @classmethod
+ def validate_saved_view_id(cls, value: object) -> str | None:
+ if value is None or value == "":
+ return None
+ if not isinstance(value, str):
+ raise ValueError("savedViewId must be a string.")
+ return value
diff --git a/products/dashboards/backend/widget_specs/registry.py b/products/dashboards/backend/widget_specs/registry.py
index 3696ef2bca50..6426819e2e49 100644
--- a/products/dashboards/backend/widget_specs/registry.py
+++ b/products/dashboards/backend/widget_specs/registry.py
@@ -12,16 +12,23 @@ from products.dashboards.backend.widget_specs.configs import (
ERROR_TRACKING_LIST_WIDGET_TYPE,
EXPERIMENT_RESULTS_WIDGET_TYPE,
EXPERIMENTS_LIST_WIDGET_TYPE,
+ LOGS_LIST_WIDGET_TYPE,
SESSION_REPLAY_LIST_WIDGET_TYPE,
ActivityEventsListWidgetConfig,
ErrorTrackingListWidgetConfig,
ExperimentResultsWidgetConfig,
ExperimentsListWidgetConfig,
+ LogsListWidgetConfig,
SessionReplayListWidgetConfig,
)
DashboardWidgetType = Literal[
- "activity_events_list", "error_tracking_list", "session_replay_list", "experiments_list", "experiment_results"
+ "activity_events_list",
+ "error_tracking_list",
+ "session_replay_list",
+ "experiments_list",
+ "experiment_results",
+ "logs_list",
]
__all__ = [
@@ -83,6 +90,7 @@ def _load_widget_specs() -> dict[str, WidgetSpec]:
from products.dashboards.backend.widgets.error_tracking_list import run_error_tracking_list_widget # noqa: PLC0415
from products.dashboards.backend.widgets.experiment_results import run_experiment_results_widget # noqa: PLC0415
from products.dashboards.backend.widgets.experiments_list import run_experiments_list_widget # noqa: PLC0415
+ from products.dashboards.backend.widgets.logs_list import run_logs_list_widget # noqa: PLC0415
from products.dashboards.backend.widgets.session_replay_list import run_session_replay_list_widget # noqa: PLC0415
return {
@@ -161,6 +169,23 @@ def _load_widget_specs() -> dict[str, WidgetSpec]:
form_fields=("experimentId",),
filter_fields=("experimentId",),
),
+ LOGS_LIST_WIDGET_TYPE: WidgetSpec(
+ widget_type=LOGS_LIST_WIDGET_TYPE,
+ config_model=LogsListWidgetConfig,
+ query_fn=run_logs_list_widget,
+ required_scopes=("logs:read",),
+ group_id="logs",
+ group_label="Logs",
+ label="Recent logs",
+ description="Latest log lines, filterable by severity level and service.",
+ required_product_access="logs",
+ product_access_denied_message="You do not have access to logs.",
+ # No cheap team-flag setup check for logs (availability would need a ClickHouse
+ # has-logs query, which we keep off the widget-add path) — leave ungated like activity.
+ availability_requirements=(),
+ form_fields=("limit", "dateRange", "wrapLines", "timezone"),
+ filter_fields=("severityLevels", "serviceNames"),
+ ),
}
diff --git a/products/dashboards/backend/widgets/logs_list.py b/products/dashboards/backend/widgets/logs_list.py
new file mode 100644
index 000000000000..06395494276d
--- /dev/null
+++ b/products/dashboards/backend/widgets/logs_list.py
@@ -0,0 +1,101 @@
+from __future__ import annotations
+
+from typing import Any, cast
+
+from posthog.schema import DateRange, FilterLogicalOperator, LogsQuery, PropertyGroupFilter
+
+from posthog.clickhouse.query_tagging import Feature, Product, tags_context
+from posthog.models.team import Team
+from posthog.models.user import User
+
+from products.dashboards.backend.constants import LOGS_LIST_MAX_LIMIT
+from products.dashboards.backend.widget_specs.configs import LOGS_LIST_WIDGET_TYPE
+from products.dashboards.backend.widget_specs.registry import validate_widget_config
+from products.dashboards.backend.widgets.list_widget import ListWidgetPage, run_list_widget
+from products.logs.backend.facade.queries import LogsQueryRunner, build_logs_query_for_saved_view
+
+ValidatedLogsListWidgetConfig = dict[str, Any]
+
+DEFAULT_LOGS_WIDGET_DATE_FROM = "-1h"
+
+# Compact subset of the log row the widget renders; the full attribute maps are dropped via
+# `excludeAttributes` to keep the tile payload small.
+# Required fields are read directly so a missing value fails fast; optional fields stay lenient.
+LOGS_WIDGET_REQUIRED_FIELDS = ("uuid", "timestamp", "body")
+LOGS_WIDGET_OPTIONAL_FIELDS = ("severity_text", "level", "trace_id")
+
+
+def _resolve_date_from(config: ValidatedLogsListWidgetConfig) -> str:
+ date_range_raw = config.get("dateRange")
+ if date_range_raw is not None:
+ date_from_value = date_range_raw.get("date_from")
+ if isinstance(date_from_value, str):
+ return date_from_value
+ return DEFAULT_LOGS_WIDGET_DATE_FROM
+
+
+def _build_logs_query(team: Team, config: ValidatedLogsListWidgetConfig, limit: int) -> LogsQuery:
+ saved_view_id = config.get("savedViewId")
+ if saved_view_id:
+ query = build_logs_query_for_saved_view(
+ team,
+ saved_view_id,
+ order_by=config["orderBy"],
+ limit=limit,
+ offset=0,
+ exclude_attributes=True,
+ )
+ if query is not None:
+ return query
+ # Saved view was deleted or never existed — fall back to the widget's own config.
+
+ return LogsQuery(
+ kind="LogsQuery",
+ dateRange=DateRange(date_from=_resolve_date_from(config), date_to=None),
+ severityLevels=config.get("severityLevels") or [],
+ serviceNames=config.get("serviceNames") or [],
+ filterGroup=PropertyGroupFilter(type=FilterLogicalOperator.AND_, values=[]),
+ orderBy=config["orderBy"],
+ limit=limit,
+ offset=0,
+ excludeAttributes=True,
+ )
+
+
+def _run_logs_query(team: Team, query: LogsQuery) -> dict[str, Any]:
+ with tags_context(product=Product.LOGS, feature=Feature.QUERY, team_id=team.pk):
+ return LogsQueryRunner(team=team, query=query).calculate().model_dump(mode="json")
+
+
+def _transform_row(row: dict[str, Any]) -> dict[str, Any]:
+ return {
+ **{field: row[field] for field in LOGS_WIDGET_REQUIRED_FIELDS},
+ **{field: row.get(field) for field in LOGS_WIDGET_OPTIONAL_FIELDS},
+ }
+
+
+def run_logs_list_widget(
+ team: Team,
+ config: dict[str, Any],
+ user: User | None = None,
+ *,
+ include_total_count: bool = True,
+) -> dict[str, Any]:
+ typed_config = validate_widget_config(LOGS_LIST_WIDGET_TYPE, config)
+
+ def fetch_page(page_limit: int) -> ListWidgetPage:
+ data = _run_logs_query(team, _build_logs_query(team, typed_config, page_limit))
+ raw_results = data.get("results")
+ return ListWidgetPage(
+ results=raw_results if isinstance(raw_results, list) else [],
+ has_more=bool(data.get("hasMore")),
+ )
+
+ return run_list_widget(
+ limit=typed_config["limit"],
+ count_cap=LOGS_LIST_MAX_LIMIT,
+ include_total_count=include_total_count,
+ fetch_page=fetch_page,
+ transform_row=lambda row: _transform_row(cast(dict[str, Any], row)),
+ log_key="logs_widget_total_count_failed",
+ )
diff --git a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
index b919e8b25c1b..f0c487fbf5e0 100644
--- a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
+++ b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
@@ -232,6 +232,7 @@ export const WIDGET_LIST_COUNT_EVENTS: WidgetListCountNoun = { singular: 'event'
export const WIDGET_LIST_COUNT_ISSUES: WidgetListCountNoun = { singular: 'issue', plural: 'issues' }
export const WIDGET_LIST_COUNT_RECORDINGS: WidgetListCountNoun = { singular: 'recording', plural: 'recordings' }
export const WIDGET_LIST_COUNT_EXPERIMENTS: WidgetListCountNoun = { singular: 'experiment', plural: 'experiments' }
+export const WIDGET_LIST_COUNT_LOGS: WidgetListCountNoun = { singular: 'log line', plural: 'log lines' }
export function formatWidgetListCountFooter(
shown: number,
diff --git a/products/dashboards/frontend/components/WidgetCard/index.ts b/products/dashboards/frontend/components/WidgetCard/index.ts
index b95ca97d4d77..291d243e60b2 100644
--- a/products/dashboards/frontend/components/WidgetCard/index.ts
+++ b/products/dashboards/frontend/components/WidgetCard/index.ts
@@ -11,6 +11,7 @@ export {
WIDGET_LIST_COUNT_EVENTS,
WIDGET_LIST_COUNT_EXPERIMENTS,
WIDGET_LIST_COUNT_ISSUES,
+ WIDGET_LIST_COUNT_LOGS,
WIDGET_LIST_COUNT_RECORDINGS,
WidgetLoadingState,
} from './WidgetCardBody'
diff --git a/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts b/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
index ad58bdbaab87..cb73a9a37170 100644
--- a/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
+++ b/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
@@ -1,6 +1,7 @@
import type { DashboardWidgetCatalogKey } from '../../widget_types/catalog'
import { getDashboardWidgetCatalogEntry } from '../../widget_types/catalog'
import { activityEventsSampleEvents } from '../../widgets/activity/activityEventsSampleData'
+import { logsWidgetSampleLogLines } from '../../widgets/logs/logsWidgetSampleData'
export type WidgetOverviewDemoState = {
title?: string
@@ -342,6 +343,21 @@ export function getWidgetOverviewDemoState(catalogKey: DashboardWidgetCatalogKey
loading: false,
result: experimentResultsSamplePayload,
}
+ case 'logs_list':
+ return {
+ title: defaultTitle,
+ description: catalogEntry.description,
+ showDescription: true,
+ config: { ...defaultConfig },
+ loading: false,
+ result: {
+ results: logsWidgetSampleLogLines,
+ hasMore: true,
+ limit: 10,
+ totalCount: 25,
+ totalCountCapped: true,
+ },
+ }
default: {
const exhaustiveCheck: never = catalogKey
return exhaustiveCheck
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index d916ad43c165..0ef84eff543c 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -416,6 +416,7 @@ export interface DashboardFiltersOpenApiApi {
* * `error_tracking_list` - error_tracking_list
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
+ * * `logs_list` - logs_list
* * `session_replay_list` - session_replay_list
*/
export type DashboardPatchWidgetOpenApiWidgetTypeEnumApi =
@@ -426,6 +427,7 @@ export const DashboardPatchWidgetOpenApiWidgetTypeEnumApi = {
ErrorTrackingList: 'error_tracking_list',
ExperimentResults: 'experiment_results',
ExperimentsList: 'experiments_list',
+ LogsList: 'logs_list',
SessionReplayList: 'session_replay_list',
} as const
@@ -696,12 +698,69 @@ export interface ExperimentResultsWidgetConfigApi {
experimentId?: number | null
}
+/**
+ * Sort by newest (latest) or oldest (earliest) first.
+ */
+export type LogsListWidgetConfigApiOrderBy =
+ (typeof LogsListWidgetConfigApiOrderBy)[keyof typeof LogsListWidgetConfigApiOrderBy]
+
+export const LogsListWidgetConfigApiOrderBy = {
+ Latest: 'latest',
+ Earliest: 'earliest',
+} as const
+
+export type LogsListWidgetConfigApiSeverityLevelsItem =
+ (typeof LogsListWidgetConfigApiSeverityLevelsItem)[keyof typeof LogsListWidgetConfigApiSeverityLevelsItem]
+
+export const LogsListWidgetConfigApiSeverityLevelsItem = {
+ Trace: 'trace',
+ Debug: 'debug',
+ Info: 'info',
+ Warn: 'warn',
+ Error: 'error',
+ Fatal: 'fatal',
+} as const
+
+/**
+ * Render log timestamps in UTC or in each viewer's local timezone.
+ */
+export type LogsListWidgetConfigApiTimezone =
+ (typeof LogsListWidgetConfigApiTimezone)[keyof typeof LogsListWidgetConfigApiTimezone]
+
+export const LogsListWidgetConfigApiTimezone = {
+ Utc: 'UTC',
+ Local: 'local',
+} as const
+
+export interface LogsListWidgetConfigApi {
+ dateRange?: WidgetDateRangeApi | null
+ /**
+ * Maximum number of log lines to return.
+ * @minimum 1
+ * @maximum 100
+ */
+ limit?: number
+ /** Sort by newest (latest) or oldest (earliest) first. */
+ orderBy?: LogsListWidgetConfigApiOrderBy
+ /** Only show logs at these severity levels. Empty shows all levels. */
+ severityLevels?: LogsListWidgetConfigApiSeverityLevelsItem[]
+ /** Only show logs from these services. Empty shows all services. */
+ serviceNames?: string[]
+ /** Wrap long log lines instead of truncating them to a single row. */
+ wrapLines?: boolean
+ /** Render log timestamps in UTC or in each viewer's local timezone. */
+ timezone?: LogsListWidgetConfigApiTimezone
+ /** short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply. */
+ savedViewId?: string | null
+}
+
export type DashboardWidgetConfigApi =
| ActivityEventsListWidgetConfigApi
| ErrorTrackingListWidgetConfigApi
| SessionReplayListWidgetConfigApi
| ExperimentsListWidgetConfigApi
| ExperimentResultsWidgetConfigApi
+ | LogsListWidgetConfigApi
export interface DashboardPatchWidgetOpenApiApi {
/** Existing widget row ID when updating a widget tile via dashboard PATCH. */
@@ -712,6 +771,7 @@ export interface DashboardPatchWidgetOpenApiApi {
* * `error_tracking_list` - error_tracking_list
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
+ * * `logs_list` - logs_list
* * `session_replay_list` - session_replay_list */
widget_type?: DashboardPatchWidgetOpenApiWidgetTypeEnumApi
/** Widget-specific configuration. Shape depends on the tile's widget_type. */
@@ -8242,19 +8302,45 @@ export interface ExperimentResultsWidgetAddRequestOpenApiApi {
config: ExperimentResultsWidgetConfigApi
}
+export type LogsListWidgetAddRequestOpenApiApiWidgetType =
+ (typeof LogsListWidgetAddRequestOpenApiApiWidgetType)[keyof typeof LogsListWidgetAddRequestOpenApiApiWidgetType]
+
+export const LogsListWidgetAddRequestOpenApiApiWidgetType = {
+ LogsList: 'logs_list',
+} as const
+
+export interface LogsListWidgetAddRequestOpenApiApi {
+ /**
+ * Optional custom display name for the widget tile.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null
+ /** Optional markdown description shown when show_description is enabled. */
+ description?: string
+ /** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */
+ layouts?: _WidgetTileLayoutsOpenApiApi
+ /** Whether to show the description on the dashboard tile. */
+ show_description?: boolean
+ widget_type: LogsListWidgetAddRequestOpenApiApiWidgetType
+ /** Configuration for the recent logs widget. */
+ config: LogsListWidgetConfigApi
+}
+
export type AddDashboardWidgetRequestApi =
| ActivityEventsListWidgetAddRequestOpenApiApi
| ErrorTrackingListWidgetAddRequestOpenApiApi
| SessionReplayListWidgetAddRequestOpenApiApi
| ExperimentsListWidgetAddRequestOpenApiApi
| ExperimentResultsWidgetAddRequestOpenApiApi
+ | LogsListWidgetAddRequestOpenApiApi
/**
* OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.
*/
export interface AddDashboardWidgetsBatchRequestOpenApiApi {
/**
- * Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
+ * Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
* @minItems 1
* @maxItems 10
*/
@@ -8381,12 +8467,36 @@ export interface ExperimentResultsWidgetUpdateRequestOpenApiApi {
config?: ExperimentResultsWidgetConfigApi
}
+export type LogsListWidgetUpdateRequestOpenApiApiWidgetType =
+ (typeof LogsListWidgetUpdateRequestOpenApiApiWidgetType)[keyof typeof LogsListWidgetUpdateRequestOpenApiApiWidgetType]
+
+export const LogsListWidgetUpdateRequestOpenApiApiWidgetType = {
+ LogsList: 'logs_list',
+} as const
+
+export interface LogsListWidgetUpdateRequestOpenApiApi {
+ /** ID of the widget tile to update. Use dashboard-get to look up widget tile IDs. */
+ tile_id: number
+ /**
+ * New display name for the widget. Empty string or null clears it; omit to leave unchanged.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null
+ /** New markdown description for the widget. Omit to leave unchanged. */
+ description?: string
+ widget_type: LogsListWidgetUpdateRequestOpenApiApiWidgetType
+ /** New configuration for the recent logs widget. Omit to leave unchanged. */
+ config?: LogsListWidgetConfigApi
+}
+
export type UpdateDashboardWidgetRequestApi =
| ActivityEventsListWidgetUpdateRequestOpenApiApi
| ErrorTrackingListWidgetUpdateRequestOpenApiApi
| SessionReplayListWidgetUpdateRequestOpenApiApi
| ExperimentsListWidgetUpdateRequestOpenApiApi
| ExperimentResultsWidgetUpdateRequestOpenApiApi
+ | LogsListWidgetUpdateRequestOpenApiApi
/**
* OpenAPI-only batch-update schema with widget_type-discriminated config shapes for agents.
@@ -8544,12 +8654,32 @@ export interface ExperimentResultsWidgetCatalogEntryOpenApiApi {
required_product_access?: string | null
}
+export type LogsListWidgetCatalogEntryOpenApiApiWidgetType =
+ (typeof LogsListWidgetCatalogEntryOpenApiApiWidgetType)[keyof typeof LogsListWidgetCatalogEntryOpenApiApiWidgetType]
+
+export const LogsListWidgetCatalogEntryOpenApiApiWidgetType = {
+ LogsList: 'logs_list',
+} as const
+
+export interface LogsListWidgetCatalogEntryOpenApiApi {
+ widget_type: LogsListWidgetCatalogEntryOpenApiApiWidgetType
+ group_id: string
+ group_label: string
+ label: string
+ description: string
+ /** OpenAPI config shape for this widget type (documentation; matches batch-add/PATCH schemas). */
+ readonly config_schema: LogsListWidgetConfigApi
+ /** @nullable */
+ required_product_access?: string | null
+}
+
export type WidgetCatalogEntryApi =
| ActivityEventsListWidgetCatalogEntryOpenApiApi
| ErrorTrackingListWidgetCatalogEntryOpenApiApi
| SessionReplayListWidgetCatalogEntryOpenApiApi
| ExperimentsListWidgetCatalogEntryOpenApiApi
| ExperimentResultsWidgetCatalogEntryOpenApiApi
+ | LogsListWidgetCatalogEntryOpenApiApi
export interface WidgetCatalogResponseApi {
/** Registered dashboard widget types available when dashboard-widgets is enabled. */
@@ -8637,6 +8767,15 @@ export const ExperimentResultsWidgetTypeEnumApi = {
ExperimentResults: 'experiment_results',
} as const
+/**
+ * * `logs_list` - logs_list
+ */
+export type LogsListWidgetTypeEnumApi = (typeof LogsListWidgetTypeEnumApi)[keyof typeof LogsListWidgetTypeEnumApi]
+
+export const LogsListWidgetTypeEnumApi = {
+ LogsList: 'logs_list',
+} as const
+
export type DashboardTemplatesListParams = {
/**
* Omit for all templates. When set, filter by featured flag; parsed with str_to_bool (same as other API query booleans).
diff --git a/products/dashboards/frontend/generated/api.zod.ts b/products/dashboards/frontend/generated/api.zod.ts
index b48d9e1d89dd..e9292930ce62 100644
--- a/products/dashboards/frontend/generated/api.zod.ts
+++ b/products/dashboards/frontend/generated/api.zod.ts
@@ -237,6 +237,12 @@ export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `created_at`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault = `DESC`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax = 100
+
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixOrderByDefault = `latest`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixWrapLinesDefault = false
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixTimezoneDefault = `UTC`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneNameMax = 400
export const dashboardsPartialUpdateBodyDeleteInsightsDefault = false
@@ -298,14 +304,15 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'error_tracking_list',
'experiment_results',
'experiments_list',
+ 'logs_list',
'session_replay_list',
])
.describe(
- '\* `activity_events_list` - activity_events_list\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `session_replay_list` - session_replay_list'
+ '\* `activity_events_list` - activity_events_list\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list'
)
.optional()
.describe(
- 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `session_replay_list` - session_replay_list'
+ 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list'
),
config: zod
.union([
@@ -681,6 +688,77 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'Experiment to show results for. Null until the user picks one in the widget settings.'
),
}),
+ zod.object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax)
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault
+ )
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixOrderByDefault
+ )
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe(
+ 'Only show logs at these severity levels. Empty shows all levels.'
+ ),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixWrapLinesDefault
+ )
+ .describe(
+ 'Wrap long log lines instead of truncating them to a single row.'
+ ),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixTimezoneDefault
+ )
+ .describe(
+ "Render log timestamps in UTC or in each viewer's local timezone."
+ ),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ }),
])
.optional()
.describe("Widget-specific configuration. Shape depends on the tile's widget_type."),
@@ -896,6 +974,14 @@ export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirect
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax = 100
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneOrderByDefault = `latest`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneWrapLinesDefault = false
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneTimezoneDefault = `UTC`
export const dashboardsWidgetsBatchCreateBodyWidgetsMax = 10
export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
@@ -1551,12 +1637,130 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
})
.describe('Configuration for the experiment results widget.'),
}),
+ zod.object({
+ name: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
+ .nullish()
+ .describe('Optional custom display name for the widget tile.'),
+ description: zod
+ .string()
+ .optional()
+ .describe('Optional markdown description shown when show_description is enabled.'),
+ layouts: zod
+ .object({
+ sm: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.'
+ ),
+ xs: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),
+ })
+ .optional()
+ .describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),
+ show_description: zod
+ .boolean()
+ .optional()
+ .describe('Whether to show the description on the dashboard tile.'),
+ widget_type: zod.enum(['logs_list']),
+ config: zod
+ .object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault)
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneOrderByDefault)
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe('Only show logs at these severity levels. Empty shows all levels.'),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneWrapLinesDefault)
+ .describe('Wrap long log lines instead of truncating them to a single row.'),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneTimezoneDefault)
+ .describe("Render log timestamps in UTC or in each viewer's local timezone."),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ })
+ .describe('Configuration for the recent logs widget.'),
+ }),
])
)
.min(1)
.max(dashboardsWidgetsBatchCreateBodyWidgetsMax)
.describe(
- 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
+ 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
),
})
.describe('OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.')
@@ -1600,6 +1804,14 @@ export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirect
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax = 100
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneOrderByDefault = `latest`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneWrapLinesDefault = false
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneTimezoneDefault = `UTC`
export const dashboardsUpdateWidgetsBatchBodyWidgetsMax = 10
export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
@@ -2050,6 +2262,83 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.optional()
.describe('New configuration for the experiment results widget. Omit to leave unchanged.'),
}),
+ zod.object({
+ tile_id: zod
+ .number()
+ .describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
+ name: zod
+ .string()
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
+ .nullish()
+ .describe(
+ 'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
+ ),
+ description: zod
+ .string()
+ .optional()
+ .describe('New markdown description for the widget. Omit to leave unchanged.'),
+ widget_type: zod.enum(['logs_list']),
+ config: zod
+ .object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault)
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneOrderByDefault)
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe('Only show logs at these severity levels. Empty shows all levels.'),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneWrapLinesDefault)
+ .describe('Wrap long log lines instead of truncating them to a single row.'),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneTimezoneDefault)
+ .describe("Render log timestamps in UTC or in each viewer's local timezone."),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ })
+ .optional()
+ .describe('New configuration for the recent logs widget. Omit to leave unchanged.'),
+ }),
])
)
.min(1)
diff --git a/products/dashboards/frontend/generated/widget-config-property-keys.json b/products/dashboards/frontend/generated/widget-config-property-keys.json
index 38c6d77654bc..c6e798c33a3c 100644
--- a/products/dashboards/frontend/generated/widget-config-property-keys.json
+++ b/products/dashboards/frontend/generated/widget-config-property-keys.json
@@ -22,7 +22,17 @@
"widgetFilters"
],
"experiments_list": ["createdBy", "limit", "orderBy", "orderDirection", "status"],
- "experiment_results": ["experimentId"]
+ "experiment_results": ["experimentId"],
+ "logs_list": [
+ "dateRange",
+ "limit",
+ "orderBy",
+ "savedViewId",
+ "serviceNames",
+ "severityLevels",
+ "timezone",
+ "wrapLines"
+ ]
},
"configPropertyTrees": {
"activity_events_list": {
@@ -286,6 +296,38 @@
"experimentId": {
"$type": "integer"
}
+ },
+ "logs_list": {
+ "dateRange": {
+ "date_from": {
+ "$enum": ["-14d", "-1M", "-1h", "-24h", "-30M", "-30d", "-3h", "-7d", "-90d"]
+ }
+ },
+ "limit": {
+ "$type": "integer"
+ },
+ "orderBy": {
+ "$enum": ["earliest", "latest"]
+ },
+ "severityLevels": {
+ "$array": {
+ "$enum": ["debug", "error", "fatal", "info", "trace", "warn"]
+ }
+ },
+ "serviceNames": {
+ "$array": {
+ "$type": "string"
+ }
+ },
+ "wrapLines": {
+ "$type": "boolean"
+ },
+ "timezone": {
+ "$enum": ["UTC", "local"]
+ },
+ "savedViewId": {
+ "$type": "string"
+ }
}
}
}
diff --git a/products/dashboards/frontend/generated/widget-config-schemas/logsListWidgetConfig.zod.ts b/products/dashboards/frontend/generated/widget-config-schemas/logsListWidgetConfig.zod.ts
new file mode 100644
index 000000000000..79195f748087
--- /dev/null
+++ b/products/dashboards/frontend/generated/widget-config-schemas/logsListWidgetConfig.zod.ts
@@ -0,0 +1,55 @@
+/**
+ * Generated by orval v8.14.0 🍺
+ * Do not edit manually.
+ * PostHog API - 1 ops
+ * OpenAPI spec version: 1.0.0
+ */
+import { z as zod } from 'zod'
+
+import { WidgetDateRange } from './widgetDateRange.zod'
+
+export const logsListWidgetConfigLimitDefault = 50
+export const logsListWidgetConfigLimitMax = 100
+
+export const logsListWidgetConfigOrderByDefault = `latest`
+export const logsListWidgetConfigWrapLinesDefault = false
+export const logsListWidgetConfigTimezoneDefault = `UTC`
+
+export const LogsListWidgetConfig = /* @__PURE__ */ zod.object({
+ dateRange: zod.union([WidgetDateRange, zod.null()]).optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(logsListWidgetConfigLimitMax)
+ .default(logsListWidgetConfigLimitDefault)
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(logsListWidgetConfigOrderByDefault)
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe('Only show logs at these severity levels. Empty shows all levels.'),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(logsListWidgetConfigWrapLinesDefault)
+ .describe('Wrap long log lines instead of truncating them to a single row.'),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(logsListWidgetConfigTimezoneDefault)
+ .describe("Render log timestamps in UTC or in each viewer's local timezone."),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+})
+
+export type LogsListWidgetConfig = zod.input<typeof LogsListWidgetConfig>
+export type LogsListWidgetConfigOutput = zod.output<typeof LogsListWidgetConfig>
diff --git a/products/dashboards/frontend/generated/widget-configs.zod.ts b/products/dashboards/frontend/generated/widget-configs.zod.ts
index 4721b823afdf..9632a2a306db 100644
--- a/products/dashboards/frontend/generated/widget-configs.zod.ts
+++ b/products/dashboards/frontend/generated/widget-configs.zod.ts
@@ -7,6 +7,7 @@ import { ActivityEventsListWidgetConfig } from './widget-config-schemas/activity
import { ErrorTrackingListWidgetConfig } from './widget-config-schemas/errorTrackingListWidgetConfig.zod'
import { ExperimentResultsWidgetConfig as ExperimentResultsWidgetConfigComponent } from './widget-config-schemas/experimentResultsWidgetConfig.zod'
import { ExperimentsListWidgetConfig } from './widget-config-schemas/experimentsListWidgetConfig.zod'
+import { LogsListWidgetConfig } from './widget-config-schemas/logsListWidgetConfig.zod'
import { SessionReplayListWidgetConfig } from './widget-config-schemas/sessionReplayListWidgetConfig.zod'
import { WidgetFilterEntry } from './widget-config-schemas/widgetFilterEntry.zod'
@@ -14,6 +15,7 @@ export const activityEventsWidgetConfigSchema = /* @__PURE__ */ ActivityEventsLi
export const errorTrackingWidgetConfigSchema = /* @__PURE__ */ ErrorTrackingListWidgetConfig
export const experimentResultsWidgetConfigSchema = /* @__PURE__ */ ExperimentResultsWidgetConfigComponent
export const experimentsWidgetConfigSchema = /* @__PURE__ */ ExperimentsListWidgetConfig
+export const logsWidgetConfigSchema = /* @__PURE__ */ LogsListWidgetConfig
export const sessionReplayWidgetConfigSchema = /* @__PURE__ */ SessionReplayListWidgetConfig
export const widgetFilterEntrySchema = /* @__PURE__ */ WidgetFilterEntry
@@ -21,6 +23,7 @@ export type ActivityEventsWidgetConfig = zod.infer<typeof activityEventsWidgetCo
export type ErrorTrackingWidgetConfig = zod.infer<typeof errorTrackingWidgetConfigSchema>
export type ExperimentResultsWidgetConfig = zod.infer<typeof experimentResultsWidgetConfigSchema>
export type ExperimentsWidgetConfig = zod.infer<typeof experimentsWidgetConfigSchema>
+export type LogsWidgetConfig = zod.infer<typeof logsWidgetConfigSchema>
export type SessionReplayWidgetConfig = zod.infer<typeof sessionReplayWidgetConfigSchema>
type WidgetFiltersRecord = NonNullable<ActivityEventsWidgetConfig['widgetFilters']>
@@ -55,6 +58,13 @@ export const experimentsWidgetFormSchema = experimentsWidgetConfigSchema.pick({
createdBy: true,
})
+export const logsWidgetFormSchema = logsWidgetConfigSchema.pick({
+ limit: true,
+ dateRange: true,
+ wrapLines: true,
+ timezone: true,
+})
+
export const sessionReplayWidgetFormSchema = sessionReplayWidgetConfigSchema.pick({
limit: true,
orderBy: true,
diff --git a/products/dashboards/frontend/generated/widget-form-fields.json b/products/dashboards/frontend/generated/widget-form-fields.json
index 75d03ef6c988..9e55c8ac2ba0 100644
--- a/products/dashboards/frontend/generated/widget-form-fields.json
+++ b/products/dashboards/frontend/generated/widget-form-fields.json
@@ -24,6 +24,12 @@
"formSchemaExport": "experimentsWidgetFormSchema",
"formFields": ["limit", "orderBy", "orderDirection", "status", "createdBy"]
},
+ "logs_list": {
+ "configSchemaExport": "logsWidgetConfigSchema",
+ "configTypeExport": "LogsWidgetConfig",
+ "formSchemaExport": "logsWidgetFormSchema",
+ "formFields": ["limit", "dateRange", "wrapLines", "timezone"]
+ },
"session_replay_list": {
"configSchemaExport": "sessionReplayWidgetConfigSchema",
"configTypeExport": "SessionReplayWidgetConfig",
diff --git a/products/dashboards/frontend/types.ts b/products/dashboards/frontend/types.ts
index 813944565793..ea8bee36d159 100644
--- a/products/dashboards/frontend/types.ts
+++ b/products/dashboards/frontend/types.ts
@@ -1,4 +1,4 @@
/**
* Product RBAC for gated widget types. New types: extend union here — see products/dashboards/CONTRIBUTING.md.
*/
-export type DashboardWidgetProductAccess = 'error_tracking' | 'session_recording' | 'experiment'
+export type DashboardWidgetProductAccess = 'error_tracking' | 'session_recording' | 'experiment' | 'logs'
diff --git a/products/dashboards/frontend/widgetProductAccess.ts b/products/dashboards/frontend/widgetProductAccess.ts
index e54e836ead0b..ab0ada0f513d 100644
--- a/products/dashboards/frontend/widgetProductAccess.ts
+++ b/products/dashboards/frontend/widgetProductAccess.ts
@@ -9,6 +9,7 @@ const WIDGET_PRODUCT_ACCESS_CHECKS = {
error_tracking: () => userHasAccess(AccessControlResourceType.ErrorTracking, AccessControlLevel.Viewer),
session_recording: () => userHasAccess(AccessControlResourceType.SessionRecording, AccessControlLevel.Viewer),
experiment: () => userHasAccess(AccessControlResourceType.Experiment, AccessControlLevel.Viewer),
+ logs: () => userHasAccess(AccessControlResourceType.Logs, AccessControlLevel.Viewer),
} satisfies Record<DashboardWidgetProductAccess, () => boolean>
export function userHasDashboardWidgetProductAccess(productAccess: DashboardWidgetProductAccess | undefined): boolean {
diff --git a/products/dashboards/frontend/widget_types/catalog.ts b/products/dashboards/frontend/widget_types/catalog.ts
index 6984170c6c03..2aa6a0e6b5b9 100644
--- a/products/dashboards/frontend/widget_types/catalog.ts
+++ b/products/dashboards/frontend/widget_types/catalog.ts
@@ -1,6 +1,6 @@
import type { ComponentType } from 'react'
-import { IconFlask, IconLive, IconRewindPlay, IconWarning } from '@posthog/icons'
+import { IconFlask, IconList, IconLive, IconRewindPlay, IconWarning } from '@posthog/icons'
import { urls } from 'scenes/urls'
@@ -12,6 +12,7 @@ import {
errorTrackingWidgetConfigSchema,
experimentResultsWidgetConfigSchema,
experimentsWidgetConfigSchema,
+ logsWidgetConfigSchema,
sessionReplayWidgetConfigSchema,
} from '../generated/widget-configs.zod'
import type { DashboardWidgetProductAccess } from '../types'
@@ -21,6 +22,7 @@ import {
ExperimentResultsWidgetPreview,
ExperimentsListWidgetPreview,
} from '../widgets/previews/ExperimentsWidgetPreviews'
+import { LogsWidgetPreview } from '../widgets/previews/LogsWidgetPreview'
import { SessionReplayWidgetPreview } from '../widgets/previews/SessionReplayWidgetPreview'
import type { WidgetAvailabilityConfig, WidgetAvailabilityRequirementId } from './widgetAvailability'
@@ -79,6 +81,7 @@ export const DASHBOARD_WIDGET_GROUP_LABELS = {
error_tracking: 'Error tracking',
session_replay: 'Session replay',
experiments: 'Experiments',
+ logs: 'Logs',
} as const satisfies Record<string, string>
export function getDashboardWidgetGroupLabel(groupId: string): string {
@@ -91,6 +94,7 @@ export const DASHBOARD_WIDGET_GROUP_ICONS = {
error_tracking: IconWarning,
session_replay: IconRewindPlay,
experiments: IconFlask,
+ logs: IconList,
} as const satisfies Record<keyof typeof DASHBOARD_WIDGET_GROUP_LABELS, ComponentType<{ className?: string }>>
export function getDashboardWidgetGroupIcon(groupId: string): ComponentType<{ className?: string }> | undefined {
@@ -266,6 +270,22 @@ export const DASHBOARD_WIDGET_CATALOG = {
message: 'Log in to PostHog to explore the latest events from this dashboard.',
},
},
+ logs_list: {
+ groupId: 'logs',
+ label: 'Recent logs',
+ description: 'Latest log lines, filterable by severity level and service.',
+ headerTitle: 'Recent logs',
+ defaultConfig: logsWidgetConfigSchema.parse({
+ dateRange: { date_from: '-1h' },
+ }),
+ defaultLayout: { w: 6, h: 5, minW: 3, minH: 3 },
+ productAccess: 'logs',
+ titleHref: urls.logs(),
+ sharedPlaceholder: {
+ title: 'Recent logs',
+ message: 'Log in to PostHog to see the latest logs from this dashboard.',
+ },
+ },
} as const satisfies Record<string, DashboardWidgetCatalogEntry>
export type DashboardWidgetCatalogKey = keyof typeof DASHBOARD_WIDGET_CATALOG
@@ -277,6 +297,7 @@ export const DASHBOARD_WIDGET_PREVIEWS: Record<DashboardWidgetCatalogKey, () =>
session_replay_list: SessionReplayWidgetPreview,
experiments_list: ExperimentsListWidgetPreview,
experiment_results: ExperimentResultsWidgetPreview,
+ logs_list: LogsWidgetPreview,
}
export type ResolvedDashboardWidgetCatalogEntry = DashboardWidgetCatalogEntry & {
diff --git a/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts b/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts
index 0d3bafdb79d2..090cf0eb1eb0 100644
--- a/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts
+++ b/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts
@@ -1,3 +1,4 @@
+import type { WidgetDateFromValue } from '../widget_types/widgetConfigShared'
import type { DashboardWidgetEditModalProps } from './registry'
type ValidationResult = { success: true } | { success: false; fieldErrors: Record<string, string> }
@@ -64,7 +65,7 @@ export const widgetEditModalTileReducers = {
export const widgetEditModalListFieldActions = {
setLimit: (limit: number) => ({ limit }),
- setDateFrom: (dateFrom: string) => ({ dateFrom }),
+ setDateFrom: (dateFrom: WidgetDateFromValue) => ({ dateFrom }),
}
export const widgetEditModalListFieldReducers = {
@@ -75,9 +76,9 @@ export const widgetEditModalListFieldReducers = {
},
],
dateFrom: [
- '-7d',
+ '-7d' as WidgetDateFromValue,
{
- setDateFrom: (_: string, { dateFrom }: { dateFrom: string }) => dateFrom,
+ setDateFrom: (_: WidgetDateFromValue, { dateFrom }: { dateFrom: WidgetDateFromValue }) => dateFrom,
},
],
}
diff --git a/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.stories.tsx b/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.stories.tsx
new file mode 100644
index 000000000000..d5f3b862105b
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.stories.tsx
@@ -0,0 +1,55 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { widgetStorybookParameters } from '../../components/WidgetCard/widgetCardStoryFixtures'
+import { getDashboardWidgetCatalogEntry } from '../../widget_types/catalog'
+import type { DashboardWidgetEditModalProps } from '../registry'
+import { EditLogsWidgetModal } from './EditLogsWidgetModal'
+
+const LOGS_CATALOG = getDashboardWidgetCatalogEntry('logs_list')!
+const DEFAULT_CONFIG = LOGS_CATALOG.defaultConfig as Record<string, unknown>
+
+type EditLogsWidgetModalStoryProps = Partial<DashboardWidgetEditModalProps>
+
+function EditLogsWidgetModalStory({
+ isOpen = true,
+ onClose = () => undefined,
+ onSave = () => Promise.resolve(),
+ config = DEFAULT_CONFIG,
+ name = 'Recent logs',
+ defaultTitle = LOGS_CATALOG.headerTitle ?? LOGS_CATALOG.label,
+ description = 'Keep an eye on the latest log lines from your services.',
+ ...props
+}: EditLogsWidgetModalStoryProps): JSX.Element {
+ return (
+ <EditLogsWidgetModal
+ isOpen={isOpen}
+ onClose={onClose}
+ config={config}
+ onSave={onSave}
+ name={name}
+ defaultTitle={defaultTitle}
+ description={description}
+ {...props}
+ />
+ )
+}
+
+// Storybook CSF requires a string literal `title` derived from catalog groupLabel/label.
+const meta: Meta<typeof EditLogsWidgetModalStory> = {
+ title: 'Dashboards/Dashboard Widgets/Widget types/Logs/Recent logs/Widget settings',
+ component: EditLogsWidgetModalStory,
+ parameters: {
+ layout: 'fullscreen',
+ ...widgetStorybookParameters,
+ },
+ decorators: [],
+ args: {
+ config: { ...DEFAULT_CONFIG, dateRange: { date_from: '-24h' } },
+ },
+}
+
+export default meta
+
+type Story = StoryObj<typeof EditLogsWidgetModalStory>
+
+export const Default: Story = {}
diff --git a/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.tsx b/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.tsx
new file mode 100644
index 000000000000..6a52ff036146
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/EditLogsWidgetModal.tsx
@@ -0,0 +1,167 @@
+import { BindLogic, useActions, useValues } from 'kea'
+
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
+import { LemonField } from 'lib/lemon-ui/LemonField/LemonField'
+import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'
+import { LemonModal } from 'lib/lemon-ui/LemonModal'
+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
+import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch'
+
+import { getDashboardWidgetGroupLabel } from '../../widget_types/catalog'
+import { WIDGET_DATE_RANGE_SELECT_OPTIONS, type WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
+import { EditWidgetModalTileDetailsSection } from '../EditWidgetModalTileDetailsSection'
+import type { DashboardWidgetEditModalProps } from '../registry'
+import { editLogsWidgetModalLogic } from './editLogsWidgetModalLogic'
+import type { LogsTimezone } from './logsWidgetConfigValidation'
+
+const TIMEZONE_OPTIONS: { value: LogsTimezone; label: string }[] = [
+ { value: 'UTC', label: 'UTC' },
+ { value: 'local', label: 'Local time' },
+]
+
+function EditLogsWidgetModalContents(): JSX.Element {
+ const {
+ limit,
+ wrapLines,
+ timezone,
+ dateFrom,
+ tileName,
+ tileDescription,
+ activeFieldErrors,
+ saving,
+ saveDisabledReason,
+ onClose,
+ defaultTitle,
+ } = useValues(editLogsWidgetModalLogic)
+ const {
+ setLimit,
+ setWrapLines,
+ setTimezone,
+ setDateFrom,
+ setTileName,
+ setTileDescription,
+ clearFieldError,
+ submit,
+ } = useActions(editLogsWidgetModalLogic)
+
+ return (
+ <LemonModal
+ isOpen
+ onClose={onClose}
+ title="Widget settings"
+ description="Configure tile details and which logs appear on this dashboard."
+ width={680}
+ footer={
+ <>
+ <div className="flex-1" />
+ <LemonButton type="secondary" onClick={onClose} disabled={saving}>
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ onClick={() => submit()}
+ >
+ Save
+ </LemonButton>
+ </>
+ }
+ >
+ <div className="flex flex-col gap-4">
+ <EditWidgetModalTileDetailsSection
+ tileName={tileName}
+ tileDescription={tileDescription}
+ defaultTitle={defaultTitle}
+ saving={saving}
+ setTileName={setTileName}
+ setTileDescription={setTileDescription}
+ />
+ <LemonDivider className="my-0" />
+ <section className="flex flex-col gap-3">
+ <h5 className="text-sm font-semibold m-0">{getDashboardWidgetGroupLabel('logs')}</h5>
+ <p className="text-sm text-muted m-0">
+ Severity, service, and sort filters live on the tile filter bar. Use this modal for the date
+ range and how many log lines to show.
+ </p>
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
+ <LemonField.Pure label="Date range">
+ <LemonSelect
+ value={dateFrom as WidgetDateFromValue}
+ disabled={saving}
+ options={WIDGET_DATE_RANGE_SELECT_OPTIONS}
+ onChange={(value) => {
+ if (value) {
+ setDateFrom(value)
+ }
+ }}
+ fullWidth
+ />
+ </LemonField.Pure>
+ <LemonField.Pure
+ label="Number of log lines"
+ help="Show up to 100 log lines on the tile."
+ error={activeFieldErrors.limit}
+ >
+ <LemonInput
+ type="number"
+ min={1}
+ max={100}
+ fullWidth
+ value={limit}
+ onChange={(value) => {
+ setLimit(Number(value))
+ clearFieldError('limit')
+ }}
+ />
+ </LemonField.Pure>
+ <LemonField.Pure label="Timestamps" help="Display log times in UTC or your local timezone.">
+ <LemonSelect
+ value={timezone}
+ disabled={saving}
+ options={TIMEZONE_OPTIONS}
+ onChange={(value) => {
+ if (value) {
+ setTimezone(value)
+ }
+ }}
+ fullWidth
+ />
+ </LemonField.Pure>
+ </div>
+ <LemonSwitch
+ checked={wrapLines}
+ onChange={setWrapLines}
+ disabled={saving}
+ label="Wrap long log lines"
+ bordered
+ />
+ </section>
+ </div>
+ </LemonModal>
+ )
+}
+
+export function EditLogsWidgetModal({
+ isOpen,
+ onClose,
+ config,
+ onSave,
+ name,
+ defaultTitle,
+ description,
+}: DashboardWidgetEditModalProps): JSX.Element | null {
+ if (!isOpen) {
+ return null
+ }
+
+ return (
+ <BindLogic
+ logic={editLogsWidgetModalLogic}
+ props={{ onClose, config, onSave, name, defaultTitle, description }}
+ >
+ <EditLogsWidgetModalContents />
+ </BindLogic>
+ )
+}
diff --git a/products/dashboards/frontend/widgets/logs/LogsWidget.stories.tsx b/products/dashboards/frontend/widgets/logs/LogsWidget.stories.tsx
new file mode 100644
index 000000000000..386673bf7492
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/LogsWidget.stories.tsx
@@ -0,0 +1,164 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import type { ReactNode } from 'react'
+
+import { mswDecorator } from '~/mocks/browser'
+import { DashboardPlacement } from '~/types'
+
+import { WidgetCard } from '../../components/WidgetCard/WidgetCard'
+import { WidgetCardBody } from '../../components/WidgetCard/WidgetCardBody'
+import { WidgetCardHeader, widgetCardShouldHideMoreButton } from '../../components/WidgetCard/WidgetCardHeader'
+import {
+ mockMoreOverlay,
+ widgetStorybookParameters,
+ widgetTileFrameDecorator,
+} from '../../components/WidgetCard/widgetCardStoryFixtures'
+import { getDashboardWidgetCatalogEntry, getDashboardWidgetGroupLabel } from '../../widget_types/catalog'
+import { DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON } from '../constants'
+import type { DashboardWidgetComponentProps } from '../registry'
+import { LogsWidget } from './LogsWidget'
+import { logsWidgetSampleLogLines } from './logsWidgetSampleData'
+import { LogsWidgetTileFilters } from './LogsWidgetTileFilters'
+
+const LOGS_CATALOG = getDashboardWidgetCatalogEntry('logs_list')!
+const DEFAULT_CONFIG = LOGS_CATALOG.defaultConfig as Record<string, unknown>
+
+const logsServicesMock = mswDecorator({
+ get: {
+ '/api/environments/:team_id/logs/values': () => [
+ 200,
+ { results: [{ name: 'api' }, { name: 'web' }, { name: 'worker' }, { name: 'billing-service' }] },
+ ],
+ },
+})
+
+type LogsWidgetTileStoryProps = DashboardWidgetComponentProps & {
+ title?: string
+ description?: string
+ showDescription?: boolean
+ body?: ReactNode
+ filterBar?: ReactNode
+ /** When true, tile filter bar matches view-only dashboard access (no edit permissions). */
+ tileFiltersReadOnly?: boolean
+}
+
+function LogsWidgetTileStory({
+ title = '',
+ description = 'Latest log lines, filterable by severity level and service.',
+ showDescription = true,
+ body,
+ filterBar,
+ tileFiltersReadOnly = false,
+ ...widgetProps
+}: LogsWidgetTileStoryProps): JSX.Element {
+ const widgetTypeLabel = getDashboardWidgetGroupLabel(LOGS_CATALOG.groupId)
+ const defaultTitle = LOGS_CATALOG.headerTitle ?? LOGS_CATALOG.label
+
+ return (
+ <WidgetCard className="h-full">
+ <WidgetCardHeader
+ layout={LOGS_CATALOG.headerLayout}
+ title={title}
+ defaultTitle={defaultTitle}
+ titleHref={LOGS_CATALOG.titleHref}
+ widgetTypeLabel={widgetTypeLabel}
+ config={widgetProps.config}
+ headerMeta={LOGS_CATALOG.headerMeta}
+ description={description}
+ showDescription={showDescription}
+ loading={widgetProps.loading}
+ shouldHideMoreButton={widgetCardShouldHideMoreButton(DashboardPlacement.Dashboard, false)}
+ moreButtonOverlay={mockMoreOverlay}
+ />
+ {filterBar ?? (
+ <LogsWidgetTileFilters
+ tileId={widgetProps.tileId ?? 1}
+ config={widgetProps.config}
+ onUpdateConfig={tileFiltersReadOnly ? undefined : widgetProps.onUpdateConfig}
+ disabledReason={tileFiltersReadOnly ? DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON : undefined}
+ />
+ )}
+ <WidgetCardBody>{body ?? <LogsWidget {...widgetProps} />}</WidgetCardBody>
+ </WidgetCard>
+ )
+}
+
+const meta: Meta<typeof LogsWidgetTileStory> = {
+ title: 'Dashboards/Dashboard Widgets/Widget types/Logs/Recent logs',
+ component: LogsWidgetTileStory,
+ parameters: {
+ layout: 'padded',
+ ...widgetStorybookParameters,
+ },
+ decorators: [logsServicesMock, ...widgetTileFrameDecorator],
+ args: {
+ tileId: 1,
+ config: DEFAULT_CONFIG,
+ loading: false,
+ result: null,
+ onUpdateConfig: () => undefined,
+ onRefresh: () => undefined,
+ },
+}
+
+export default meta
+
+type Story = StoryObj<typeof LogsWidgetTileStory>
+
+export const Default: Story = {
+ args: {
+ title: 'Recent logs',
+ config: DEFAULT_CONFIG,
+ loading: false,
+ result: {
+ results: logsWidgetSampleLogLines,
+ hasMore: true,
+ limit: 10,
+ totalCount: 25,
+ totalCountCapped: true,
+ },
+ },
+}
+
+export const TileFiltersReadOnly: Story = {
+ args: {
+ title: 'Recent logs',
+ config: { ...DEFAULT_CONFIG, severityLevels: ['error', 'warn'], serviceNames: ['api'], orderBy: 'earliest' },
+ tileFiltersReadOnly: true,
+ loading: false,
+ result: {
+ results: logsWidgetSampleLogLines,
+ hasMore: true,
+ limit: 10,
+ totalCount: 25,
+ totalCountCapped: true,
+ },
+ },
+ parameters: {
+ docs: {
+ description: {
+ story: 'Tile filter bar when the viewer lacks dashboard edit access — severity, service, and sort are read-only.',
+ },
+ },
+ },
+}
+
+export const Loading: Story = {
+ args: {
+ title: 'Recent logs',
+ config: DEFAULT_CONFIG,
+ loading: true,
+ result: null,
+ },
+ parameters: {
+ testOptions: { waitForLoadersToDisappear: false },
+ },
+}
+
+export const Empty: Story = {
+ args: {
+ title: 'Recent logs',
+ config: DEFAULT_CONFIG,
+ loading: false,
+ result: { results: [] },
+ },
+}
diff --git a/products/dashboards/frontend/widgets/logs/LogsWidget.tsx b/products/dashboards/frontend/widgets/logs/LogsWidget.tsx
new file mode 100644
index 000000000000..79eaaaad764a
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/LogsWidget.tsx
@@ -0,0 +1,136 @@
+import { combineUrl } from 'kea-router'
+
+import { DetectiveHog } from 'lib/components/hedgehogs'
+import { getLocalTimeZone } from 'lib/utils/timezones'
+import { urls } from 'scenes/urls'
+
+import {
+ WIDGET_LIST_COUNT_LOGS,
+ WidgetCardBodyMessage,
+ WidgetCardContent,
+ WidgetContentFooter,
+ WidgetListCount,
+} from '../../components/WidgetCard'
+import type { DashboardWidgetComponentProps } from '../registry'
+import { parseLogsWidgetConfig } from './logsWidgetConfigValidation'
+import { LogsWidgetRow, LogsWidgetRowSkeleton, type LogsWidgetLogLine } from './LogsWidgetRow'
+
+export type LogsWidgetResult = {
+ results?: LogsWidgetLogLine[]
+ hasMore?: boolean
+ limit?: number
+ totalCount?: number
+ totalCountCapped?: boolean
+}
+
+/** 'local' renders in the viewer's own timezone; 'UTC' (default) renders the same for everyone. */
+function resolveDisplayTimezone(timezone: string | null | undefined): string {
+ if (timezone === 'local') {
+ return getLocalTimeZone()
+ }
+ return 'UTC'
+}
+
+type LogsDeepLinkParams = {
+ dateFrom: string | null | undefined
+ orderBy: string | null | undefined
+ limit: number | null | undefined
+ severityLevels: string[]
+ serviceNames: string[]
+ hasSavedView: boolean
+}
+
+/** Deep-link that opens this log on the logs page (new tab), reproducing the tile's filtered view.
+ *
+ * Forwarding the tile's filters + orderBy + a matching `initialLogsLimit` makes the logs page's first
+ * page equal the tile's visible rows, so the linked log is loaded and `linkToLogId` can open it. A
+ * saved-view tile can't replay the view's filters (or its date range) client-side, so it links by id
+ * only and lets the logs page use its own range — forwarding the tile's `-1h` default would likely
+ * exclude the clicked log. */
+function buildLogHref(line: LogsWidgetLogLine, params: LogsDeepLinkParams): string {
+ return combineUrl(urls.logs(), {
+ activeTab: 'viewer',
+ linkToLogId: line.uuid,
+ ...(params.hasSavedView ? {} : { dateRange: { date_from: params.dateFrom ?? null, date_to: null } }),
+ ...(params.orderBy ? { orderBy: params.orderBy } : {}),
+ ...(params.limit ? { initialLogsLimit: params.limit } : {}),
+ ...(!params.hasSavedView && params.severityLevels.length ? { severityLevels: params.severityLevels } : {}),
+ ...(!params.hasSavedView && params.serviceNames.length ? { serviceNames: params.serviceNames } : {}),
+ }).url
+}
+
+export function LogsWidget({ result, loading, config }: DashboardWidgetComponentProps): JSX.Element {
+ const payload = result as LogsWidgetResult | null | undefined
+ const logLines = payload?.results ?? []
+
+ const parsedConfig = parseLogsWidgetConfig(config)
+ const wrapLines = parsedConfig.wrapLines ?? false
+ const displayTimezone = resolveDisplayTimezone(parsedConfig.timezone)
+ const deepLinkParams: LogsDeepLinkParams = {
+ dateFrom: parsedConfig.dateRange?.date_from,
+ orderBy: parsedConfig.orderBy,
+ limit: parsedConfig.limit,
+ severityLevels: parsedConfig.severityLevels ?? [],
+ serviceNames: parsedConfig.serviceNames ?? [],
+ hasSavedView: !!parsedConfig.savedViewId,
+ }
+
+ if (loading) {
+ return (
+ <WidgetCardContent>
+ <div className="flex flex-col divide-y divide-border">
+ {Array.from({ length: 6 }, (_, index) => (
+ <LogsWidgetRowSkeleton key={index} />
+ ))}
+ </div>
+ </WidgetCardContent>
+ )
+ }
+
+ if (logLines.length === 0) {
+ return (
+ <WidgetCardContent>
+ <WidgetCardBodyMessage>
+ <div
+ className="flex max-w-xs flex-col items-center gap-2 px-2 text-balance"
+ data-attr="logs-widget-empty-state"
+ >
+ <DetectiveHog className="size-20 shrink-0" />
+ <p className="m-0 text-base font-semibold text-primary">No logs found</p>
+ <p className="m-0 text-sm text-muted">
+ No logs matched your severity and service filters for this date range.
+ </p>
+ </div>
+ </WidgetCardBodyMessage>
+ </WidgetCardContent>
+ )
+ }
+
+ return (
+ <>
+ <WidgetCardContent>
+ <div className="flex flex-col divide-y divide-border">
+ {logLines.map((line) => (
+ <LogsWidgetRow
+ key={line.uuid}
+ line={line}
+ wrapLines={wrapLines}
+ displayTimezone={displayTimezone}
+ href={buildLogHref(line, deepLinkParams)}
+ />
+ ))}
+ </div>
+ </WidgetCardContent>
+ <WidgetContentFooter>
+ <WidgetListCount
+ shown={logLines.length}
+ totalCount={payload?.totalCount}
+ totalCountIsLowerBound={payload?.totalCountCapped}
+ noun={WIDGET_LIST_COUNT_LOGS}
+ hasMore={payload?.hasMore}
+ dataAttr="logs-widget-count"
+ />
+ </WidgetContentFooter>
+ </>
+ )
+}
diff --git a/products/dashboards/frontend/widgets/logs/LogsWidgetRow.tsx b/products/dashboards/frontend/widgets/logs/LogsWidgetRow.tsx
new file mode 100644
index 000000000000..9edcf8ac6d8b
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/LogsWidgetRow.tsx
@@ -0,0 +1,100 @@
+import { TZLabel } from 'lib/components/TZLabel'
+import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
+import { Link } from 'lib/lemon-ui/Link'
+import { Tooltip } from 'lib/lemon-ui/Tooltip'
+import { cn } from 'lib/utils/css-classes'
+
+import type { LogMessage } from '~/queries/schema/schema-general'
+
+import { SEVERITY_BAR_COLORS } from 'products/logs/frontend/components/VirtualizedLogsList/columnDefinitions'
+
+export type LogsWidgetLogLine = {
+ uuid: string
+ timestamp: string
+ /** OTel severity text, e.g. "info", "error". `level` is the same value (runner aliases it). */
+ severity_text?: string | null
+ level?: string | null
+ body: string
+ trace_id?: string | null
+}
+
+function severityKey(line: LogsWidgetLogLine): string {
+ return (line.severity_text ?? line.level ?? '').toLowerCase()
+}
+
+function severityLabel(line: LogsWidgetLogLine): string {
+ return (line.severity_text ?? line.level ?? 'log').toUpperCase()
+}
+
+/** Reuse the logs viewer's severity bar colors so a row reads the same as on the logs page. */
+function severityBarClass(line: LogsWidgetLogLine): string {
+ return SEVERITY_BAR_COLORS[severityKey(line) as LogMessage['severity_text']] ?? 'bg-muted-3000'
+}
+
+export function LogsWidgetRowSkeleton(): JSX.Element {
+ return (
+ <div className="flex items-center gap-2 px-3 py-1.5">
+ <LemonSkeleton className="h-4 w-1 shrink-0 rounded-full" />
+ <LemonSkeleton className="h-3 w-32 shrink-0" />
+ <LemonSkeleton className="h-3 flex-1" />
+ </div>
+ )
+}
+
+export function LogsWidgetRow({
+ line,
+ wrapLines = false,
+ displayTimezone,
+ href,
+}: {
+ line: LogsWidgetLogLine
+ wrapLines?: boolean
+ displayTimezone?: string
+ href?: string
+}): JSX.Element {
+ const content = (
+ <div
+ className={cn(
+ 'group flex gap-2 px-3 py-1.5 hover:bg-fill-highlight-100',
+ wrapLines ? 'items-start' : 'items-center'
+ )}
+ data-attr="logs-widget-row"
+ >
+ <Tooltip title={severityLabel(line)}>
+ <div
+ aria-label={severityLabel(line)}
+ className={cn('w-1 shrink-0 self-stretch rounded-full', severityBarClass(line))}
+ />
+ </Tooltip>
+ <span className="shrink-0 font-mono text-xs text-muted">
+ <TZLabel
+ time={line.timestamp}
+ formatDate="YYYY-MM-DD"
+ formatTime="HH:mm:ss.SSS"
+ displayTimezone={displayTimezone}
+ timestampStyle="absolute"
+ showPopover={false}
+ />
+ </span>
+ <span
+ className={cn(
+ 'min-w-0 flex-1 font-mono text-xs text-primary',
+ wrapLines ? 'whitespace-pre-wrap break-all' : 'truncate'
+ )}
+ title={wrapLines ? undefined : line.body}
+ >
+ {line.body}
+ </span>
+ </div>
+ )
+
+ if (href) {
+ return (
+ <Link to={href} target="_blank" className="block text-current hover:text-current" subtle>
+ {content}
+ </Link>
+ )
+ }
+
+ return content
+}
diff --git a/products/dashboards/frontend/widgets/logs/LogsWidgetTileFilters.tsx b/products/dashboards/frontend/widgets/logs/LogsWidgetTileFilters.tsx
new file mode 100644
index 000000000000..401bd35393ef
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/LogsWidgetTileFilters.tsx
@@ -0,0 +1,190 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useMemo, useRef } from 'react'
+
+import { IconExternal } from '@posthog/icons'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { urls } from 'scenes/urls'
+
+import type { DateRange, LogMessage } from '~/queries/schema/schema-general'
+
+import { ServiceFilter } from 'products/logs/frontend/components/LogsViewer/Filters/ServiceFilter'
+import { SeverityLevelsFilter } from 'products/logs/frontend/components/LogsViewer/Filters/SeverityLevelsFilter'
+
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
+import type { DashboardWidgetTileFiltersProps } from '../registry'
+import { useWidgetTileConfigPersist } from '../widgetTileFiltersHooks'
+import { WidgetTileFilterReadOnlyValue, WidgetTileFiltersBar } from '../widgetTileFiltersReadOnly'
+import {
+ LOGS_DEFAULT_DATE_FROM,
+ parseLogsWidgetConfig,
+ patchLogsWidgetFilterFields,
+ type LogsOrderByValue,
+ type LogsSeverityLevel,
+} from './logsWidgetConfigValidation'
+import { logsWidgetSavedViewsLogic } from './logsWidgetSavedViewsLogic'
+
+export type LogsWidgetTileFiltersProps = DashboardWidgetTileFiltersProps
+
+const SORT_OPTIONS: { value: LogsOrderByValue; label: string }[] = [
+ { value: 'latest', label: 'Newest first' },
+ { value: 'earliest', label: 'Oldest first' },
+]
+
+const ALL_SEVERITY_LEVELS = 6
+
+const NO_SAVED_VIEW_OPTION = { value: null as string | null, label: 'No saved view' }
+const CREATE_SAVED_VIEW_VALUE = '__create_saved_view__'
+
+function severityReadOnlyLabel(levels: LogsSeverityLevel[]): string {
+ if (levels.length === 0 || levels.length === ALL_SEVERITY_LEVELS) {
+ return 'All levels'
+ }
+ return levels.join(', ')
+}
+
+function servicesReadOnlyLabel(services: string[]): string {
+ if (services.length === 0) {
+ return 'All services'
+ }
+ if (services.length === 1) {
+ return services[0]
+ }
+ return `${services.length} services`
+}
+
+export function LogsWidgetTileFilters({
+ config,
+ onUpdateConfig,
+ disabledReason,
+}: LogsWidgetTileFiltersProps): JSX.Element {
+ const parsed = parseLogsWidgetConfig(config)
+ const severityLevels = (parsed.severityLevels ?? []) as LogsSeverityLevel[]
+ const serviceNames = parsed.serviceNames ?? []
+ const orderBy = (parsed.orderBy ?? 'latest') as LogsOrderByValue
+ const dateFrom = (parsed.dateRange?.date_from ?? LOGS_DEFAULT_DATE_FROM) as WidgetDateFromValue
+ const savedViewId = parsed.savedViewId ?? null
+ const hasSavedView = !!savedViewId
+
+ const { featureFlags } = useValues(featureFlagLogic)
+ const savedViewsEnabled = !!featureFlags[FEATURE_FLAGS.LOGS_SAVED_VIEWS]
+ // Keep the picker reachable when a view is already persisted, even if the flag is later turned
+ // off — otherwise the tile would be stuck on that view with no way to clear it.
+ const showSavedViewPicker = savedViewsEnabled || hasSavedView
+ const { savedViewOptions, savedViewsLoading, savedViewLabelById } = useValues(logsWidgetSavedViewsLogic)
+ const { ensureSavedViewsLoaded } = useActions(logsWidgetSavedViewsLogic)
+
+ useEffect(() => {
+ if (showSavedViewPicker) {
+ ensureSavedViewsLoaded()
+ }
+ }, [showSavedViewPicker, ensureSavedViewsLoaded])
+
+ const savedViewSelectOptions = useMemo(
+ () => [
+ NO_SAVED_VIEW_OPTION,
+ ...savedViewOptions,
+ {
+ value: CREATE_SAVED_VIEW_VALUE,
+ label: 'Create a saved view',
+ sideIcon: <IconExternal className="size-3.5" />,
+ },
+ ],
+ [savedViewOptions]
+ )
+ const savedViewLabel = savedViewId ? (savedViewLabelById[savedViewId] ?? savedViewId) : savedViewId
+
+ const configRef = useRef(config)
+ configRef.current = config
+ const { persistConfigNow } = useWidgetTileConfigPersist(onUpdateConfig)
+
+ // Severity and service pickers can't render a disabled state, so when editing is unavailable
+ // (view-only dashboard, or no edit permission) show the read-only summary instead of dead controls.
+ const canUpdate = !!onUpdateConfig && !disabledReason
+
+ const applyPatch = async (patch: {
+ severityLevels?: LogsSeverityLevel[]
+ serviceNames?: string[]
+ orderBy?: LogsOrderByValue
+ savedViewId?: string | null
+ }): Promise<void> => {
+ const nextConfig = patchLogsWidgetFilterFields(configRef.current, patch)
+ configRef.current = nextConfig
+ await persistConfigNow(nextConfig)
+ }
+
+ const applySavedView = async (value: string | null): Promise<void> => {
+ // The "create" item is a navigation shortcut, not a persisted value.
+ if (value === CREATE_SAVED_VIEW_VALUE) {
+ window.open(urls.logs(), '_blank', 'noopener,noreferrer')
+ return
+ }
+ await applyPatch({ savedViewId: value })
+ }
+
+ if (!canUpdate) {
+ return (
+ <WidgetTileFiltersBar dataAttr="logs-widget-tile-filters-readonly">
+ {hasSavedView ? (
+ <WidgetTileFilterReadOnlyValue>
+ <span className="text-secondary">Saved view:</span> {savedViewLabel}
+ </WidgetTileFilterReadOnlyValue>
+ ) : (
+ <>
+ <WidgetTileFilterReadOnlyValue>
+ <span className="text-secondary">Levels:</span> {severityReadOnlyLabel(severityLevels)}
+ </WidgetTileFilterReadOnlyValue>
+ <WidgetTileFilterReadOnlyValue>
+ <span className="text-secondary">Services:</span> {servicesReadOnlyLabel(serviceNames)}
+ </WidgetTileFilterReadOnlyValue>
+ </>
+ )}
+ <WidgetTileFilterReadOnlyValue>
+ {SORT_OPTIONS.find((option) => option.value === orderBy)?.label ?? orderBy}
+ </WidgetTileFilterReadOnlyValue>
+ </WidgetTileFiltersBar>
+ )
+ }
+
+ const serviceDateRange: DateRange = { date_from: dateFrom, date_to: null }
+
+ return (
+ <WidgetTileFiltersBar dataAttr="logs-widget-tile-filters">
+ {showSavedViewPicker ? (
+ <LemonSelect
+ size="small"
+ value={savedViewId}
+ loading={savedViewsLoading}
+ options={savedViewSelectOptions}
+ placeholder="Saved view"
+ onChange={(value) => void applySavedView(value ?? null)}
+ />
+ ) : null}
+ {!hasSavedView ? (
+ <>
+ <SeverityLevelsFilter
+ value={severityLevels as LogMessage['severity_text'][]}
+ onChange={(levels) => void applyPatch({ severityLevels: levels as LogsSeverityLevel[] })}
+ />
+ <ServiceFilter
+ value={serviceNames}
+ dateRange={serviceDateRange}
+ onChange={(services) => void applyPatch({ serviceNames: services ?? [] })}
+ />
+ </>
+ ) : null}
+ <LemonSelect
+ size="small"
+ value={orderBy}
+ options={SORT_OPTIONS}
+ onChange={(value) => {
+ if (value) {
+ void applyPatch({ orderBy: value })
+ }
+ }}
+ />
+ </WidgetTileFiltersBar>
+ )
+}
diff --git a/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts b/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts
new file mode 100644
index 000000000000..aeb9f57c3ff6
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts
@@ -0,0 +1,189 @@
+import { actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+
+import type { LogsWidgetConfig } from '../../generated/widget-configs.zod'
+import { isWidgetConfigValidationError } from '../../utils'
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
+import {
+ widgetEditModalListFieldActions,
+ widgetEditModalPropSelectors,
+ widgetEditModalTileActions,
+ buildWidgetTileMetadataPatch,
+ getWidgetEditModalTileDefaults,
+} from '../editWidgetModalBuilders'
+import type { DashboardWidgetEditModalProps } from '../registry'
+import type { editLogsWidgetModalLogicType } from './editLogsWidgetModalLogicType'
+import {
+ LOGS_DEFAULT_DATE_FROM,
+ parseLogsWidgetConfig,
+ validateLogsWidgetConfigInput,
+ type LogsTimezone,
+ type LogsWidgetFieldErrors,
+} from './logsWidgetConfigValidation'
+
+export type EditLogsWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+
+export const editLogsWidgetModalLogic = kea<editLogsWidgetModalLogicType>([
+ path(['products', 'dashboards', 'widgets', 'logs', 'editLogsWidgetModalLogic']),
+
+ props({
+ config: {},
+ onSave: async () => {},
+ onClose: () => {},
+ name: '',
+ defaultTitle: 'Untitled',
+ description: '',
+ } as EditLogsWidgetModalLogicProps),
+
+ actions({
+ ...widgetEditModalListFieldActions,
+ ...widgetEditModalTileActions,
+ setWrapLines: (wrapLines: boolean) => ({ wrapLines }),
+ setTimezone: (timezone: LogsTimezone) => ({ timezone }),
+ setFieldErrors: (fieldErrors: LogsWidgetFieldErrors) => ({ fieldErrors }),
+ clearFieldError: (field: keyof LogsWidgetFieldErrors) => ({ field }),
+ submit: true,
+ submitSuccess: true,
+ submitFailure: true,
+ }),
+
+ reducers({
+ limit: [
+ 50,
+ {
+ setLimit: (_: number, { limit }: { limit: number }) => limit,
+ },
+ ],
+ wrapLines: [
+ false,
+ {
+ setWrapLines: (_: boolean, { wrapLines }: { wrapLines: boolean }) => wrapLines,
+ },
+ ],
+ timezone: [
+ 'UTC' as LogsTimezone,
+ {
+ setTimezone: (_: LogsTimezone, { timezone }: { timezone: LogsTimezone }) => timezone,
+ },
+ ],
+ dateFrom: [
+ LOGS_DEFAULT_DATE_FROM as WidgetDateFromValue,
+ {
+ setDateFrom: (_: WidgetDateFromValue, { dateFrom }: { dateFrom: WidgetDateFromValue }) => dateFrom,
+ },
+ ],
+ tileName: [
+ '',
+ {
+ setTileName: (_: string, { tileName }: { tileName: string }) => tileName,
+ },
+ ],
+ tileDescription: [
+ '',
+ {
+ setTileDescription: (_: string, { tileDescription }: { tileDescription: string }) => tileDescription,
+ },
+ ],
+ fieldErrors: [
+ {} as LogsWidgetFieldErrors,
+ {
+ setFieldErrors: (_: LogsWidgetFieldErrors, { fieldErrors }: { fieldErrors: LogsWidgetFieldErrors }) =>
+ fieldErrors,
+ clearFieldError: (state: LogsWidgetFieldErrors, { field }: { field: keyof LogsWidgetFieldErrors }) => {
+ if (!state[field]) {
+ return state
+ }
+ const next = { ...state }
+ delete next[field]
+ return next
+ },
+ },
+ ],
+ saving: [
+ false,
+ {
+ submit: (_state: boolean, _payload: { value: true }) => true,
+ submitSuccess: (_state: boolean, _payload: { value: true }) => false,
+ submitFailure: (_state: boolean, _payload: { value: true }) => false,
+ },
+ ],
+ }),
+
+ selectors({
+ widgetConfig: [(_, p) => [p.config], (config): LogsWidgetConfig => parseLogsWidgetConfig(config)],
+ ...widgetEditModalPropSelectors,
+ validation: [
+ (s) => [s.limit, s.wrapLines, s.timezone, s.dateFrom, s.widgetConfig],
+ (limit, wrapLines, timezone, dateFrom, widgetConfig) =>
+ validateLogsWidgetConfigInput({
+ limit,
+ wrapLines,
+ timezone,
+ dateFrom,
+ baseConfig: widgetConfig,
+ }),
+ ],
+ activeFieldErrors: [
+ (s) => [s.validation, s.fieldErrors],
+ (validation, fieldErrors): LogsWidgetFieldErrors => {
+ if (!validation.success) {
+ return { ...validation.fieldErrors, ...fieldErrors }
+ }
+ return fieldErrors
+ },
+ ],
+ saveDisabledReason: [
+ (s) => [s.saving, s.validation],
+ (saving, validation): string | undefined => {
+ if (saving) {
+ return 'Saving…'
+ }
+ if (!validation.success) {
+ return 'Fix validation errors to save'
+ }
+ return undefined
+ },
+ ],
+ }),
+
+ defaults(({ props }) => {
+ const baseConfig = parseLogsWidgetConfig(props.config)
+
+ return {
+ limit: baseConfig.limit,
+ wrapLines: baseConfig.wrapLines ?? false,
+ timezone: (baseConfig.timezone ?? 'UTC') as LogsTimezone,
+ dateFrom: baseConfig.dateRange?.date_from ?? LOGS_DEFAULT_DATE_FROM,
+ ...getWidgetEditModalTileDefaults(props),
+ fieldErrors: {},
+ saving: false,
+ }
+ }),
+
+ listeners(({ actions, props, values }) => ({
+ submit: async () => {
+ const result = values.validation
+
+ if (!result.success) {
+ actions.setFieldErrors(result.fieldErrors)
+ return
+ }
+
+ try {
+ await props.onSave(
+ result.config,
+ buildWidgetTileMetadataPatch(props, values.tileName, values.tileDescription)
+ )
+ actions.setFieldErrors({})
+ props.onClose()
+ actions.submitSuccess()
+ } catch (error) {
+ actions.submitFailure()
+ if (isWidgetConfigValidationError(error)) {
+ actions.setFieldErrors(error.fieldErrors as LogsWidgetFieldErrors)
+ return
+ }
+ throw error
+ }
+ },
+ })),
+])
diff --git a/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.test.ts b/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.test.ts
new file mode 100644
index 000000000000..7715262eecec
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.test.ts
@@ -0,0 +1,108 @@
+import { ApiError } from 'lib/api-error'
+
+import {
+ LOGS_DEFAULT_DATE_FROM,
+ parseLogsWidgetConfig,
+ parseLogsWidgetConfigApiError,
+ patchLogsWidgetFilterFields,
+ validateLogsWidgetConfigInput,
+} from './logsWidgetConfigValidation'
+
+describe('logsWidgetConfigValidation', () => {
+ it('parses defaults for an empty config', () => {
+ const config = parseLogsWidgetConfig({})
+ expect(config.limit).toBe(50)
+ expect(config.orderBy).toBe('latest')
+ expect(config.wrapLines).toBe(false)
+ expect(config.timezone).toBe('UTC')
+ expect(config.severityLevels ?? []).toEqual([])
+ expect(config.serviceNames ?? []).toEqual([])
+ })
+
+ it('patches on-tile filter fields without touching the date range', () => {
+ const base = { dateRange: { date_from: '-24h' }, limit: 50, orderBy: 'latest' }
+ const patched = patchLogsWidgetFilterFields(base, {
+ severityLevels: ['error', 'warn'],
+ serviceNames: ['api'],
+ orderBy: 'earliest',
+ })
+ expect(patched.severityLevels).toEqual(['error', 'warn'])
+ expect(patched.serviceNames).toEqual(['api'])
+ expect(patched.orderBy).toBe('earliest')
+ expect(patched.dateRange?.date_from).toBe('-24h')
+ })
+
+ it('clearing severity levels persists an empty list', () => {
+ const base = { severityLevels: ['error'], serviceNames: ['api'] }
+ const patched = patchLogsWidgetFilterFields(base, { severityLevels: [] })
+ expect(patched.severityLevels).toEqual([])
+ expect(patched.serviceNames).toEqual(['api'])
+ })
+
+ it('sets and clears the saved view id', () => {
+ const withView = patchLogsWidgetFilterFields({}, { savedViewId: 'abc123' })
+ expect(withView.savedViewId).toBe('abc123')
+ // An explicit null clears it; an omitted key would have preserved it.
+ const cleared = patchLogsWidgetFilterFields(withView, { savedViewId: null })
+ expect(cleared.savedViewId ?? null).toBeNull()
+ const preserved = patchLogsWidgetFilterFields(withView, { orderBy: 'earliest' })
+ expect(preserved.savedViewId).toBe('abc123')
+ })
+
+ it('falls back to the default date range when none is set', () => {
+ const patched = patchLogsWidgetFilterFields({}, { orderBy: 'earliest' })
+ expect(patched.dateRange?.date_from).toBe(LOGS_DEFAULT_DATE_FROM)
+ })
+
+ it('validates a well-formed form input', () => {
+ const result = validateLogsWidgetConfigInput({
+ limit: 15,
+ wrapLines: true,
+ timezone: 'local',
+ dateFrom: '-24h',
+ baseConfig: parseLogsWidgetConfig({}),
+ })
+ expect(result.success).toBe(true)
+ if (result.success) {
+ expect(result.config.limit).toBe(15)
+ expect(result.config.wrapLines).toBe(true)
+ expect(result.config.timezone).toBe('local')
+ expect(result.config.dateRange?.date_from).toBe('-24h')
+ }
+ })
+
+ it('accepts a limit at the cap', () => {
+ const result = validateLogsWidgetConfigInput({
+ limit: 100,
+ wrapLines: false,
+ timezone: 'UTC',
+ dateFrom: '-1h',
+ baseConfig: parseLogsWidgetConfig({}),
+ })
+ expect(result.success).toBe(true)
+ })
+
+ it('rejects a limit above the cap', () => {
+ const result = validateLogsWidgetConfigInput({
+ limit: 101,
+ wrapLines: false,
+ timezone: 'UTC',
+ dateFrom: '-1h',
+ baseConfig: parseLogsWidgetConfig({}),
+ })
+ expect(result.success).toBe(false)
+ if (!result.success) {
+ expect(result.fieldErrors.limit).toBeTruthy()
+ }
+ })
+
+ it('maps an API error to a field error', () => {
+ const error = new ApiError('limit too big', 400, undefined, { config: 'limit too big' })
+ const fieldErrors = parseLogsWidgetConfigApiError(error, { limit: 101, orderBy: 'latest' })
+ expect(fieldErrors?.limit).toBeTruthy()
+ })
+
+ it('ignores non-API errors', () => {
+ expect(parseLogsWidgetConfigApiError(new Error('boom'), {})).toBeNull()
+ })
+})
diff --git a/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.ts b/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.ts
new file mode 100644
index 000000000000..79c9f054b8c0
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/logsWidgetConfigValidation.ts
@@ -0,0 +1,124 @@
+import { z } from 'zod'
+
+import { ApiError } from 'lib/api-error'
+
+import { logsWidgetConfigSchema, logsWidgetFormSchema, type LogsWidgetConfig } from '../../generated/widget-configs.zod'
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
+import { fieldErrorsFromZodError, parseWidgetConfig } from '../widgetConfigValidation'
+
+export const LOGS_DEFAULT_DATE_FROM: WidgetDateFromValue = '-1h'
+
+export type LogsOrderByValue = NonNullable<LogsWidgetConfig['orderBy']>
+export type LogsSeverityLevel = NonNullable<LogsWidgetConfig['severityLevels']>[number]
+export type LogsTimezone = NonNullable<LogsWidgetConfig['timezone']>
+
+export const LOGS_WIDGET_FORM_FIELD_NAMES = Object.keys(
+ logsWidgetFormSchema.shape
+) as (keyof typeof logsWidgetFormSchema.shape)[]
+
+type LogsWidgetFormField = keyof z.infer<typeof logsWidgetFormSchema>
+
+export type LogsWidgetFieldErrors = Partial<Record<LogsWidgetFormField, string>>
+
+export type LogsWidgetFormInput = {
+ limit: number
+ wrapLines: boolean
+ timezone: LogsTimezone
+ dateRange: { date_from?: string | null } | null
+}
+
+const logsConfigDefaults = logsWidgetConfigSchema.parse({})
+
+export function parseLogsWidgetConfig(config: Record<string, unknown>): LogsWidgetConfig {
+ return parseWidgetConfig(logsWidgetConfigSchema, config)
+}
+
+/** On-tile filter changes (severity, services, sort, saved view) — keeps the rest of the config untouched. */
+export function patchLogsWidgetFilterFields(
+ config: Record<string, unknown>,
+ patch: {
+ severityLevels?: LogsSeverityLevel[]
+ serviceNames?: string[]
+ orderBy?: LogsOrderByValue
+ dateFrom?: WidgetDateFromValue
+ savedViewId?: string | null
+ }
+): LogsWidgetConfig {
+ const base = parseLogsWidgetConfig(config)
+
+ return logsWidgetConfigSchema.parse({
+ ...base,
+ severityLevels: patch.severityLevels ?? base.severityLevels,
+ serviceNames: patch.serviceNames ?? base.serviceNames,
+ orderBy: patch.orderBy ?? base.orderBy,
+ dateRange: { date_from: patch.dateFrom ?? base.dateRange?.date_from ?? LOGS_DEFAULT_DATE_FROM },
+ // `savedViewId` is intentionally read with `in` so an explicit `null` clears it.
+ savedViewId: 'savedViewId' in patch ? patch.savedViewId : base.savedViewId,
+ })
+}
+
+export function buildLogsWidgetConfig(formInput: LogsWidgetFormInput, baseConfig: LogsWidgetConfig): LogsWidgetConfig {
+ return logsWidgetConfigSchema.parse({
+ ...baseConfig,
+ ...formInput,
+ })
+}
+
+export function validateLogsWidgetConfigInput(input: {
+ limit: number
+ wrapLines: boolean
+ timezone: LogsTimezone
+ dateFrom: WidgetDateFromValue
+ baseConfig: LogsWidgetConfig
+}): { success: true; config: LogsWidgetConfig } | { success: false; fieldErrors: LogsWidgetFieldErrors } {
+ const parsed = logsWidgetFormSchema.safeParse({
+ limit: input.limit,
+ wrapLines: input.wrapLines,
+ timezone: input.timezone,
+ dateRange: { date_from: input.dateFrom },
+ })
+
+ if (!parsed.success) {
+ return { success: false, fieldErrors: fieldErrorsFromZodError(parsed.error) }
+ }
+
+ const formInput: LogsWidgetFormInput = {
+ limit: parsed.data.limit,
+ wrapLines: parsed.data.wrapLines,
+ timezone: parsed.data.timezone,
+ dateRange: parsed.data.dateRange ?? null,
+ }
+
+ return {
+ success: true,
+ config: buildLogsWidgetConfig(formInput, input.baseConfig),
+ }
+}
+
+export function parseLogsWidgetConfigApiError(
+ error: unknown,
+ config: Record<string, unknown>
+): LogsWidgetFieldErrors | null {
+ if (!(error instanceof ApiError)) {
+ return null
+ }
+
+ const parsedConfig = logsWidgetConfigSchema.safeParse(config)
+ if (parsedConfig.success) {
+ return null
+ }
+
+ const parsedForm = logsWidgetFormSchema.safeParse({
+ limit: (config.limit as number) ?? logsConfigDefaults.limit ?? 0,
+ wrapLines: (config.wrapLines as boolean) ?? logsConfigDefaults.wrapLines ?? false,
+ timezone: (config.timezone as LogsTimezone) ?? logsConfigDefaults.timezone ?? 'UTC',
+ dateRange: (config.dateRange as { date_from?: string | null } | undefined) ?? {
+ date_from: LOGS_DEFAULT_DATE_FROM,
+ },
+ })
+ if (!parsedForm.success) {
+ return fieldErrorsFromZodError(parsedForm.error)
+ }
+
+ return fieldErrorsFromZodError(parsedConfig.error)
+}
diff --git a/products/dashboards/frontend/widgets/logs/logsWidgetSampleData.ts b/products/dashboards/frontend/widgets/logs/logsWidgetSampleData.ts
new file mode 100644
index 000000000000..56cde193c3e9
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/logsWidgetSampleData.ts
@@ -0,0 +1,45 @@
+import type { LogsWidgetLogLine } from './LogsWidgetRow'
+
+/** Static sample log lines for previews and Storybook (no network). */
+export const logsWidgetSampleLogLines: LogsWidgetLogLine[] = [
+ {
+ uuid: 'log-1',
+ timestamp: '2026-05-26T08:04:10.000Z',
+ severity_text: 'error',
+ level: 'error',
+ body: 'Unhandled exception while processing checkout: payment gateway timeout',
+ trace_id: 'abc123',
+ },
+ {
+ uuid: 'log-2',
+ timestamp: '2026-05-26T08:04:05.000Z',
+ severity_text: 'warn',
+ level: 'warn',
+ body: 'Retrying request to billing-service (attempt 2/3)',
+ trace_id: 'abc124',
+ },
+ {
+ uuid: 'log-3',
+ timestamp: '2026-05-26T08:04:01.000Z',
+ severity_text: 'info',
+ level: 'info',
+ body: 'User session started for distinct_id=user-42',
+ trace_id: 'abc125',
+ },
+ {
+ uuid: 'log-4',
+ timestamp: '2026-05-26T08:03:58.000Z',
+ severity_text: 'info',
+ level: 'info',
+ body: 'GET /api/projects/2/dashboards 200 in 84ms',
+ trace_id: 'abc126',
+ },
+ {
+ uuid: 'log-5',
+ timestamp: '2026-05-26T08:03:50.000Z',
+ severity_text: 'debug',
+ level: 'debug',
+ body: 'Cache miss for key dashboard:2:tiles, recomputing',
+ trace_id: 'abc127',
+ },
+]
diff --git a/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts b/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts
new file mode 100644
index 000000000000..4417fe202958
--- /dev/null
+++ b/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts
@@ -0,0 +1,61 @@
+import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { loaders } from 'kea-loaders'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { logsViewsList } from 'products/logs/frontend/generated/api'
+import type { LogsViewApi } from 'products/logs/frontend/generated/api.schemas'
+
+import type { logsWidgetSavedViewsLogicType } from './logsWidgetSavedViewsLogicType'
+
+// One page is plenty — saved views are few, so we never paginate the dropdown.
+const SAVED_VIEWS_LIMIT = 100
+
+// Saved logs filters are LogsView rows ("saved views" on the logs page). The fetch is lazy —
+// only tiles that actually surface the picker (feature flag on, or a saved view already persisted)
+// trigger it, so tiles without the feature never hit the API.
+export const logsWidgetSavedViewsLogic = kea<logsWidgetSavedViewsLogicType>([
+ path(['products', 'dashboards', 'widgets', 'logs', 'logsWidgetSavedViewsLogic']),
+ connect(() => ({
+ values: [teamLogic, ['currentProjectId']],
+ })),
+ actions({
+ ensureSavedViewsLoaded: true,
+ }),
+ reducers({
+ hasLoadedSavedViews: [false, { loadSavedViewsSuccess: () => true }],
+ }),
+ loaders(({ values }) => ({
+ savedViews: {
+ __default: [] as LogsViewApi[],
+ loadSavedViews: async () => {
+ const response = await logsViewsList(String(values.currentProjectId), { limit: SAVED_VIEWS_LIMIT })
+ return response.results ?? []
+ },
+ },
+ })),
+ selectors({
+ savedViewOptions: [
+ (s) => [s.savedViews],
+ (savedViews): { value: string; label: string }[] =>
+ savedViews.map((view) => ({
+ value: view.short_id,
+ label: view.name || 'Unnamed view',
+ })),
+ ],
+ // Single source for resolving a saved-view short_id to its display label, shared by the
+ // tile filter bar and the read-only summary.
+ savedViewLabelById: [
+ (s) => [s.savedViewOptions],
+ (savedViewOptions): Record<string, string> =>
+ Object.fromEntries(savedViewOptions.map((option) => [option.value, option.label])),
+ ],
+ }),
+ listeners(({ actions, values }) => ({
+ ensureSavedViewsLoaded: () => {
+ if (!values.hasLoadedSavedViews && !values.savedViewsLoading) {
+ actions.loadSavedViews()
+ }
+ },
+ })),
+])
diff --git a/products/dashboards/frontend/widgets/previews/LogsWidgetPreview.tsx b/products/dashboards/frontend/widgets/previews/LogsWidgetPreview.tsx
new file mode 100644
index 000000000000..a527895e7612
--- /dev/null
+++ b/products/dashboards/frontend/widgets/previews/LogsWidgetPreview.tsx
@@ -0,0 +1,12 @@
+import { LogsWidgetRow } from '../logs/LogsWidgetRow'
+import { logsWidgetSampleLogLines } from '../logs/logsWidgetSampleData'
+
+export function LogsWidgetPreview(): JSX.Element {
+ return (
+ <div className="flex flex-col divide-y divide-border shadow-sm">
+ {logsWidgetSampleLogLines.map((line) => (
+ <LogsWidgetRow key={line.uuid} line={line} />
+ ))}
+ </div>
+ )
+}
diff --git a/products/dashboards/frontend/widgets/registry.tsx b/products/dashboards/frontend/widgets/registry.tsx
index 0b4bf456c20a..61bb025d3361 100644
--- a/products/dashboards/frontend/widgets/registry.tsx
+++ b/products/dashboards/frontend/widgets/registry.tsx
@@ -34,6 +34,10 @@ import {
parseExperimentResultsWidgetConfigApiError,
parseExperimentsListWidgetConfigApiError,
} from './experiments/experimentsWidgetConfigValidation'
+import { EditLogsWidgetModal } from './logs/EditLogsWidgetModal'
+import { LogsWidget } from './logs/LogsWidget'
+import { parseLogsWidgetConfigApiError } from './logs/logsWidgetConfigValidation'
+import { LogsWidgetTileFilters } from './logs/LogsWidgetTileFilters'
import { EditSessionReplayWidgetModal } from './session_replay/EditSessionReplayWidgetModal'
import { SessionReplayWidget, SessionReplayWidgetTopHeading } from './session_replay/SessionReplayWidget'
import { parseSessionReplayWidgetConfigApiError } from './session_replay/sessionReplayWidgetConfigValidation'
@@ -174,6 +178,13 @@ export const DASHBOARD_WIDGET_REGISTRY = {
productAccess: 'experiment',
parseConfigApiError: parseExperimentResultsWidgetConfigApiError,
},
+ logs_list: {
+ Component: LogsWidget,
+ TileFilters: LogsWidgetTileFilters,
+ EditModal: EditLogsWidgetModal,
+ productAccess: 'logs',
+ parseConfigApiError: parseLogsWidgetConfigApiError,
+ },
} satisfies Record<DashboardWidgetCatalogKey, DashboardWidgetDefinition>
function isDashboardWidgetRegistryKey(widgetType: string): widgetType is DashboardWidgetCatalogKey {
diff --git a/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts b/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
index dd00d1dc0d85..af59cd4d8fa4 100644
--- a/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
+++ b/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
@@ -5,6 +5,7 @@ import {
errorTrackingWidgetConfigSchema,
experimentResultsWidgetConfigSchema,
experimentsWidgetConfigSchema,
+ logsWidgetConfigSchema,
sessionReplayWidgetConfigSchema,
widgetFilterEntrySchema,
} from '../generated/widget-configs.zod'
@@ -15,6 +16,7 @@ const WIDGET_CONFIG_SCHEMAS = {
session_replay_list: sessionReplayWidgetConfigSchema,
experiments_list: experimentsWidgetConfigSchema,
experiment_results: experimentResultsWidgetConfigSchema,
+ logs_list: logsWidgetConfigSchema,
} as const
type SchemaNode = { _zod?: { def?: ZodDef } }
diff --git a/products/logs/backend/facade/queries.py b/products/logs/backend/facade/queries.py
index f09d81122e0d..2981bb8d7474 100644
--- a/products/logs/backend/facade/queries.py
+++ b/products/logs/backend/facade/queries.py
@@ -9,5 +9,6 @@ them onto the ``django.setup()`` path.
"""
from products.logs.backend.logs_query_runner import LogsQueryRunner
+from products.logs.backend.saved_view_query import build_logs_query_for_saved_view
-__all__ = ["LogsQueryRunner"]
+__all__ = ["LogsQueryRunner", "build_logs_query_for_saved_view"]
diff --git a/products/logs/backend/saved_view_query.py b/products/logs/backend/saved_view_query.py
new file mode 100644
index 000000000000..690a1ec14429
--- /dev/null
+++ b/products/logs/backend/saved_view_query.py
@@ -0,0 +1,60 @@
+from __future__ import annotations
+
+import logging
+
+from pydantic import ValidationError
+
+from posthog.schema import DateRange, FilterLogicalOperator, LogsOrderBy, LogsQuery, PropertyGroupFilter
+
+from posthog.models.team import Team
+
+from products.logs.backend.models import LogsView
+
+logger = logging.getLogger(__name__)
+
+
+def _filter_group_from_filters(filters: dict) -> PropertyGroupFilter:
+ filter_group = filters.get("filterGroup")
+ if filter_group:
+ return PropertyGroupFilter.model_validate(filter_group)
+ return PropertyGroupFilter(type=FilterLogicalOperator.AND_, values=[])
+
+
+def build_logs_query_for_saved_view(
+ team: Team,
+ short_id: str,
+ *,
+ order_by: LogsOrderBy,
+ limit: int,
+ offset: int = 0,
+ exclude_attributes: bool = True,
+) -> LogsQuery | None:
+ """Resolve a saved logs view into a LogsQuery. Returns None if the view is missing or unusable.
+
+ The saved view owns the date range, severity, service, search, and property filters; the
+ caller still controls orderBy and limit. A `None` return lets the caller fall back to its own
+ config — this covers both a deleted view and a view whose stored `filters` blob no longer
+ matches the schema (the `filters` JSON has no inner validation on write).
+ """
+ view = LogsView.objects.filter(team=team, short_id=short_id).first()
+ if view is None:
+ return None
+
+ filters = view.filters or {}
+ date_range_raw = filters.get("dateRange") or {}
+ try:
+ return LogsQuery(
+ kind="LogsQuery",
+ dateRange=DateRange(date_from=date_range_raw.get("date_from"), date_to=date_range_raw.get("date_to")),
+ severityLevels=filters.get("severityLevels") or [],
+ serviceNames=filters.get("serviceNames") or [],
+ searchTerm=filters.get("searchTerm"),
+ filterGroup=_filter_group_from_filters(filters),
+ orderBy=order_by,
+ limit=limit,
+ offset=offset,
+ excludeAttributes=exclude_attributes,
+ )
+ except ValidationError:
+ logger.warning("logs_widget_saved_view_filters_invalid", extra={"short_id": short_id, "team_id": team.pk})
+ return None
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 5a57dda65d34..a6a1402f2919 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -4391,14 +4391,95 @@ export namespace Schemas {
config: ExperimentResultsWidgetConfig;
}
- export type AddDashboardWidgetRequest = ActivityEventsListWidgetAddRequestOpenApi | ErrorTrackingListWidgetAddRequestOpenApi | SessionReplayListWidgetAddRequestOpenApi | ExperimentsListWidgetAddRequestOpenApi | ExperimentResultsWidgetAddRequestOpenApi;
+ export type LogsListWidgetAddRequestOpenApiWidgetType = typeof LogsListWidgetAddRequestOpenApiWidgetType[keyof typeof LogsListWidgetAddRequestOpenApiWidgetType];
+
+
+ export const LogsListWidgetAddRequestOpenApiWidgetType = {
+ LogsList: 'logs_list',
+ } as const;
+
+ /**
+ * Sort by newest (latest) or oldest (earliest) first.
+ */
+ export type LogsListWidgetConfigOrderBy = typeof LogsListWidgetConfigOrderBy[keyof typeof LogsListWidgetConfigOrderBy];
+
+
+ export const LogsListWidgetConfigOrderBy = {
+ Latest: 'latest',
+ Earliest: 'earliest',
+ } as const;
+
+ export type LogsListWidgetConfigSeverityLevelsItem = typeof LogsListWidgetConfigSeverityLevelsItem[keyof typeof LogsListWidgetConfigSeverityLevelsItem];
+
+
+ export const LogsListWidgetConfigSeverityLevelsItem = {
+ Trace: 'trace',
+ Debug: 'debug',
+ Info: 'info',
+ Warn: 'warn',
+ Error: 'error',
+ Fatal: 'fatal',
+ } as const;
+
+ /**
+ * Render log timestamps in UTC or in each viewer's local timezone.
+ */
+ export type LogsListWidgetConfigTimezone = typeof LogsListWidgetConfigTimezone[keyof typeof LogsListWidgetConfigTimezone];
+
+
+ export const LogsListWidgetConfigTimezone = {
+ Utc: 'UTC',
+ Local: 'local',
+ } as const;
+
+ export interface LogsListWidgetConfig {
+ dateRange?: WidgetDateRange | null;
+ /**
+ * Maximum number of log lines to return.
+ * @minimum 1
+ * @maximum 100
+ */
+ limit?: number;
+ /** Sort by newest (latest) or oldest (earliest) first. */
+ orderBy?: LogsListWidgetConfigOrderBy;
+ /** Only show logs at these severity levels. Empty shows all levels. */
+ severityLevels?: LogsListWidgetConfigSeverityLevelsItem[];
+ /** Only show logs from these services. Empty shows all services. */
+ serviceNames?: string[];
+ /** Wrap long log lines instead of truncating them to a single row. */
+ wrapLines?: boolean;
+ /** Render log timestamps in UTC or in each viewer's local timezone. */
+ timezone?: LogsListWidgetConfigTimezone;
+ /** short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply. */
+ savedViewId?: string | null;
+ }
+
+ export interface LogsListWidgetAddRequestOpenApi {
+ /**
+ * Optional custom display name for the widget tile.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null;
+ /** Optional markdown description shown when show_description is enabled. */
+ description?: string;
+ /** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */
+ layouts?: _WidgetTileLayoutsOpenApi;
+ /** Whether to show the description on the dashboard tile. */
+ show_description?: boolean;
+ widget_type: LogsListWidgetAddRequestOpenApiWidgetType;
+ /** Configuration for the recent logs widget. */
+ config: LogsListWidgetConfig;
+ }
+
+ export type AddDashboardWidgetRequest = ActivityEventsListWidgetAddRequestOpenApi | ErrorTrackingListWidgetAddRequestOpenApi | SessionReplayListWidgetAddRequestOpenApi | ExperimentsListWidgetAddRequestOpenApi | ExperimentResultsWidgetAddRequestOpenApi | LogsListWidgetAddRequestOpenApi;
/**
* OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.
*/
export interface AddDashboardWidgetsBatchRequestOpenApi {
/**
- * Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
+ * Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
* @minItems 1
* @maxItems 10
*/
@@ -7400,7 +7481,7 @@ export namespace Schemas {
team: number;
}
- export type DashboardWidgetConfig = ActivityEventsListWidgetConfig | ErrorTrackingListWidgetConfig | SessionReplayListWidgetConfig | ExperimentsListWidgetConfig | ExperimentResultsWidgetConfig;
+ export type DashboardWidgetConfig = ActivityEventsListWidgetConfig | ErrorTrackingListWidgetConfig | SessionReplayListWidgetConfig | ExperimentsListWidgetConfig | ExperimentResultsWidgetConfig | LogsListWidgetConfig;
export interface DashboardWidget {
readonly id: string;
@@ -14560,6 +14641,7 @@ export namespace Schemas {
* * `error_tracking_list` - error_tracking_list
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
+ * * `logs_list` - logs_list
* * `session_replay_list` - session_replay_list
*/
export type DashboardPatchWidgetOpenApiWidgetTypeEnum = typeof DashboardPatchWidgetOpenApiWidgetTypeEnum[keyof typeof DashboardPatchWidgetOpenApiWidgetTypeEnum];
@@ -14570,6 +14652,7 @@ export namespace Schemas {
ErrorTrackingList: 'error_tracking_list',
ExperimentResults: 'experiment_results',
ExperimentsList: 'experiments_list',
+ LogsList: 'logs_list',
SessionReplayList: 'session_replay_list',
} as const;
@@ -14582,6 +14665,7 @@ export namespace Schemas {
* * `error_tracking_list` - error_tracking_list
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
+ * * `logs_list` - logs_list
* * `session_replay_list` - session_replay_list */
widget_type?: DashboardPatchWidgetOpenApiWidgetTypeEnum;
/** Widget-specific configuration. Shape depends on the tile's widget_type. */
@@ -28101,6 +28185,58 @@ export namespace Schemas {
threshold_operator: string;
}
+ export type LogsListWidgetCatalogEntryOpenApiWidgetType = typeof LogsListWidgetCatalogEntryOpenApiWidgetType[keyof typeof LogsListWidgetCatalogEntryOpenApiWidgetType];
+
+
+ export const LogsListWidgetCatalogEntryOpenApiWidgetType = {
+ LogsList: 'logs_list',
+ } as const;
+
+ export interface LogsListWidgetCatalogEntryOpenApi {
+ widget_type: LogsListWidgetCatalogEntryOpenApiWidgetType;
+ group_id: string;
+ group_label: string;
+ label: string;
+ description: string;
+ /** OpenAPI config shape for this widget type (documentation; matches batch-add/PATCH schemas). */
+ readonly config_schema: LogsListWidgetConfig;
+ /** @nullable */
+ required_product_access?: string | null;
+ }
+
+ /**
+ * * `logs_list` - logs_list
+ */
+ export type LogsListWidgetTypeEnum = typeof LogsListWidgetTypeEnum[keyof typeof LogsListWidgetTypeEnum];
+
+
+ export const LogsListWidgetTypeEnum = {
+ LogsList: 'logs_list',
+ } as const;
+
+ export type LogsListWidgetUpdateRequestOpenApiWidgetType = typeof LogsListWidgetUpdateRequestOpenApiWidgetType[keyof typeof LogsListWidgetUpdateRequestOpenApiWidgetType];
+
+
+ export const LogsListWidgetUpdateRequestOpenApiWidgetType = {
+ LogsList: 'logs_list',
+ } as const;
+
+ export interface LogsListWidgetUpdateRequestOpenApi {
+ /** ID of the widget tile to update. Use dashboard-get to look up widget tile IDs. */
+ tile_id: number;
+ /**
+ * New display name for the widget. Empty string or null clears it; omit to leave unchanged.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null;
+ /** New markdown description for the widget. Omit to leave unchanged. */
+ description?: string;
+ widget_type: LogsListWidgetUpdateRequestOpenApiWidgetType;
+ /** New configuration for the recent logs widget. Omit to leave unchanged. */
+ config?: LogsListWidgetConfig;
+ }
+
export type LogsSamplingRuleScopeAttributeFiltersItem = { [key: string]: unknown };
/**
@@ -41152,7 +41288,7 @@ export namespace Schemas {
config?: SessionReplayListWidgetConfig;
}
- export type UpdateDashboardWidgetRequest = ActivityEventsListWidgetUpdateRequestOpenApi | ErrorTrackingListWidgetUpdateRequestOpenApi | SessionReplayListWidgetUpdateRequestOpenApi | ExperimentsListWidgetUpdateRequestOpenApi | ExperimentResultsWidgetUpdateRequestOpenApi;
+ export type UpdateDashboardWidgetRequest = ActivityEventsListWidgetUpdateRequestOpenApi | ErrorTrackingListWidgetUpdateRequestOpenApi | SessionReplayListWidgetUpdateRequestOpenApi | ExperimentsListWidgetUpdateRequestOpenApi | ExperimentResultsWidgetUpdateRequestOpenApi | LogsListWidgetUpdateRequestOpenApi;
/**
* OpenAPI-only batch-update schema with widget_type-discriminated config shapes for agents.
@@ -51888,7 +52024,7 @@ export namespace Schemas {
is_organization_first_user: boolean;
}
- export type WidgetCatalogEntry = ActivityEventsListWidgetCatalogEntryOpenApi | ErrorTrackingListWidgetCatalogEntryOpenApi | SessionReplayListWidgetCatalogEntryOpenApi | ExperimentsListWidgetCatalogEntryOpenApi | ExperimentResultsWidgetCatalogEntryOpenApi;
+ export type WidgetCatalogEntry = ActivityEventsListWidgetCatalogEntryOpenApi | ErrorTrackingListWidgetCatalogEntryOpenApi | SessionReplayListWidgetCatalogEntryOpenApi | ExperimentsListWidgetCatalogEntryOpenApi | ExperimentResultsWidgetCatalogEntryOpenApi | LogsListWidgetCatalogEntryOpenApi;
export interface WidgetCatalogResponse {
/** Registered dashboard widget types available when dashboard-widgets is enabled. */
diff --git a/services/mcp/src/generated/dashboards/api.ts b/services/mcp/src/generated/dashboards/api.ts
index d02dbb08e2d9..50afdcdf5566 100644
--- a/services/mcp/src/generated/dashboards/api.ts
+++ b/services/mcp/src/generated/dashboards/api.ts
@@ -141,6 +141,12 @@ export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `created_at`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault = `DESC`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax = 100
+
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixOrderByDefault = `latest`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixWrapLinesDefault = false
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixTimezoneDefault = `UTC`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneNameMax = 400
export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
@@ -200,14 +206,15 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'error_tracking_list',
'experiment_results',
'experiments_list',
+ 'logs_list',
'session_replay_list',
])
.describe(
- '* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `session_replay_list` - session_replay_list'
+ '* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `logs_list` - logs_list\n* `session_replay_list` - session_replay_list'
)
.optional()
.describe(
- 'Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `session_replay_list` - session_replay_list'
+ 'Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `logs_list` - logs_list\n* `session_replay_list` - session_replay_list'
),
config: zod
.union([
@@ -583,6 +590,77 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'Experiment to show results for. Null until the user picks one in the widget settings.'
),
}),
+ zod.object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax)
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault
+ )
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixOrderByDefault
+ )
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe(
+ 'Only show logs at these severity levels. Empty shows all levels.'
+ ),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixWrapLinesDefault
+ )
+ .describe(
+ 'Wrap long log lines instead of truncating them to a single row.'
+ ),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixTimezoneDefault
+ )
+ .describe(
+ "Render log timestamps in UTC or in each viewer's local timezone."
+ ),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ }),
])
.optional()
.describe("Widget-specific configuration. Shape depends on the tile's widget_type."),
@@ -950,6 +1028,14 @@ export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirect
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax = 100
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneOrderByDefault = `latest`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneWrapLinesDefault = false
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneTimezoneDefault = `UTC`
export const dashboardsWidgetsBatchCreateBodyWidgetsMax = 10
export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
@@ -1605,12 +1691,130 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
})
.describe('Configuration for the experiment results widget.'),
}),
+ zod.object({
+ name: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
+ .nullish()
+ .describe('Optional custom display name for the widget tile.'),
+ description: zod
+ .string()
+ .optional()
+ .describe('Optional markdown description shown when show_description is enabled.'),
+ layouts: zod
+ .object({
+ sm: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.'
+ ),
+ xs: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),
+ })
+ .optional()
+ .describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),
+ show_description: zod
+ .boolean()
+ .optional()
+ .describe('Whether to show the description on the dashboard tile.'),
+ widget_type: zod.enum(['logs_list']),
+ config: zod
+ .object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault)
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneOrderByDefault)
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe('Only show logs at these severity levels. Empty shows all levels.'),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneWrapLinesDefault)
+ .describe('Wrap long log lines instead of truncating them to a single row.'),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneTimezoneDefault)
+ .describe("Render log timestamps in UTC or in each viewer's local timezone."),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ })
+ .describe('Configuration for the recent logs widget.'),
+ }),
])
)
.min(1)
.max(dashboardsWidgetsBatchCreateBodyWidgetsMax)
.describe(
- 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
+ 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
),
})
.describe('OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.')
@@ -1667,6 +1871,14 @@ export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirect
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax = 100
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneOrderByDefault = `latest`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneWrapLinesDefault = false
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneTimezoneDefault = `UTC`
export const dashboardsUpdateWidgetsBatchBodyWidgetsMax = 10
export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
@@ -2117,6 +2329,83 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.optional()
.describe('New configuration for the experiment results widget. Omit to leave unchanged.'),
}),
+ zod.object({
+ tile_id: zod
+ .number()
+ .describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
+ name: zod
+ .string()
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
+ .nullish()
+ .describe(
+ 'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
+ ),
+ description: zod
+ .string()
+ .optional()
+ .describe('New markdown description for the widget. Omit to leave unchanged.'),
+ widget_type: zod.enum(['logs_list']),
+ config: zod
+ .object({
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod.enum([
+ '-1M',
+ '-30M',
+ '-1h',
+ '-3h',
+ '-24h',
+ '-7d',
+ '-14d',
+ '-30d',
+ '-90d',
+ ]),
+ zod.null(),
+ ])
+ .optional(),
+ }),
+ zod.null(),
+ ])
+ .optional(),
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault)
+ .describe('Maximum number of log lines to return.'),
+ orderBy: zod
+ .enum(['latest', 'earliest'])
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneOrderByDefault)
+ .describe('Sort by newest (latest) or oldest (earliest) first.'),
+ severityLevels: zod
+ .array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
+ .optional()
+ .describe('Only show logs at these severity levels. Empty shows all levels.'),
+ serviceNames: zod
+ .array(zod.string())
+ .optional()
+ .describe('Only show logs from these services. Empty shows all services.'),
+ wrapLines: zod
+ .boolean()
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneWrapLinesDefault)
+ .describe('Wrap long log lines instead of truncating them to a single row.'),
+ timezone: zod
+ .enum(['UTC', 'local'])
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneTimezoneDefault)
+ .describe("Render log timestamps in UTC or in each viewer's local timezone."),
+ savedViewId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ 'short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply.'
+ ),
+ })
+ .optional()
+ .describe('New configuration for the recent logs widget. Omit to leave unchanged.'),
+ }),
])
)
.min(1)
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
index 4764848061a5..f10c2cc2e333 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
@@ -716,6 +716,94 @@
}
},
"type": "object"
+ },
+ {
+ "properties": {
+ "dateRange": {
+ "anyOf": [
+ {
+ "properties": {
+ "date_from": {
+ "anyOf": [
+ {
+ "enum": [
+ "-1M",
+ "-30M",
+ "-1h",
+ "-3h",
+ "-24h",
+ "-7d",
+ "-14d",
+ "-30d",
+ "-90d"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "limit": {
+ "default": 50,
+ "description": "Maximum number of log lines to return.",
+ "maximum": 100,
+ "minimum": 1,
+ "type": "number"
+ },
+ "orderBy": {
+ "default": "latest",
+ "description": "Sort by newest (latest) or oldest (earliest) first.",
+ "enum": ["latest", "earliest"],
+ "type": "string"
+ },
+ "savedViewId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply."
+ },
+ "serviceNames": {
+ "description": "Only show logs from these services. Empty shows all services.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "severityLevels": {
+ "description": "Only show logs at these severity levels. Empty shows all levels.",
+ "items": {
+ "enum": ["trace", "debug", "info", "warn", "error", "fatal"],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "default": "UTC",
+ "description": "Render log timestamps in UTC or in each viewer's local timezone.",
+ "enum": ["UTC", "local"],
+ "type": "string"
+ },
+ "wrapLines": {
+ "default": false,
+ "description": "Wrap long log lines instead of truncating them to a single row.",
+ "type": "boolean"
+ }
+ },
+ "type": "object"
}
],
"description": "Widget-specific configuration. Shape depends on the tile's widget_type."
@@ -741,12 +829,13 @@
"description": "Optional custom display name for the widget tile."
},
"widget_type": {
- "description": "Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `session_replay_list` - session_replay_list",
+ "description": "Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `logs_list` - logs_list\n* `session_replay_list` - session_replay_list",
"enum": [
"activity_events_list",
"error_tracking_list",
"experiment_results",
"experiments_list",
+ "logs_list",
"session_replay_list"
],
"type": "string"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
index 82a7e54e3438..40f690f777bf 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
@@ -6,7 +6,7 @@
"type": "number"
},
"widgets": {
- "description": "Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).",
+ "description": "Widget tiles to add atomically. Supported widget_type values: activity_events_list, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).",
"items": {
"anyOf": [
{
@@ -999,6 +999,175 @@
},
"required": ["widget_type", "config"],
"type": "object"
+ },
+ {
+ "properties": {
+ "config": {
+ "description": "Configuration for the recent logs widget.",
+ "properties": {
+ "dateRange": {
+ "anyOf": [
+ {
+ "properties": {
+ "date_from": {
+ "anyOf": [
+ {
+ "enum": [
+ "-1M",
+ "-30M",
+ "-1h",
+ "-3h",
+ "-24h",
+ "-7d",
+ "-14d",
+ "-30d",
+ "-90d"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "limit": {
+ "default": 50,
+ "description": "Maximum number of log lines to return.",
+ "maximum": 100,
+ "minimum": 1,
+ "type": "number"
+ },
+ "orderBy": {
+ "default": "latest",
+ "description": "Sort by newest (latest) or oldest (earliest) first.",
+ "enum": ["latest", "earliest"],
+ "type": "string"
+ },
+ "savedViewId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply."
+ },
+ "serviceNames": {
+ "description": "Only show logs from these services. Empty shows all services.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "severityLevels": {
+ "description": "Only show logs at these severity levels. Empty shows all levels.",
+ "items": {
+ "enum": ["trace", "debug", "info", "warn", "error", "fatal"],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "default": "UTC",
+ "description": "Render log timestamps in UTC or in each viewer's local timezone.",
+ "enum": ["UTC", "local"],
+ "type": "string"
+ },
+ "wrapLines": {
+ "default": false,
+ "description": "Wrap long log lines instead of truncating them to a single row.",
+ "type": "boolean"
+ }
+ },
+ "type": "object"
+ },
+ "description": {
+ "description": "Optional markdown description shown when show_description is enabled.",
+ "type": "string"
+ },
+ "layouts": {
+ "description": "Optional react-grid-layout positions keyed by breakpoint (sm, xs).",
+ "properties": {
+ "sm": {
+ "description": "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ },
+ "xs": {
+ "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional custom display name for the widget tile."
+ },
+ "show_description": {
+ "description": "Whether to show the description on the dashboard tile.",
+ "type": "boolean"
+ },
+ "widget_type": {
+ "enum": ["logs_list"],
+ "type": "string"
+ }
+ },
+ "required": ["widget_type", "config"],
+ "type": "object"
}
]
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
index f63d550afba6..140186efbb19 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
@@ -749,6 +749,125 @@
},
"required": ["tile_id", "widget_type"],
"type": "object"
+ },
+ {
+ "properties": {
+ "config": {
+ "description": "New configuration for the recent logs widget. Omit to leave unchanged.",
+ "properties": {
+ "dateRange": {
+ "anyOf": [
+ {
+ "properties": {
+ "date_from": {
+ "anyOf": [
+ {
+ "enum": [
+ "-1M",
+ "-30M",
+ "-1h",
+ "-3h",
+ "-24h",
+ "-7d",
+ "-14d",
+ "-30d",
+ "-90d"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "limit": {
+ "default": 50,
+ "description": "Maximum number of log lines to return.",
+ "maximum": 100,
+ "minimum": 1,
+ "type": "number"
+ },
+ "orderBy": {
+ "default": "latest",
+ "description": "Sort by newest (latest) or oldest (earliest) first.",
+ "enum": ["latest", "earliest"],
+ "type": "string"
+ },
+ "savedViewId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "short_id of a saved logs view to use as the source. When set, the saved view owns the date range, severity, service, and property filters; only orderBy and limit still apply."
+ },
+ "serviceNames": {
+ "description": "Only show logs from these services. Empty shows all services.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "severityLevels": {
+ "description": "Only show logs at these severity levels. Empty shows all levels.",
+ "items": {
+ "enum": ["trace", "debug", "info", "warn", "error", "fatal"],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "default": "UTC",
+ "description": "Render log timestamps in UTC or in each viewer's local timezone.",
+ "enum": ["UTC", "local"],
+ "type": "string"
+ },
+ "wrapLines": {
+ "default": false,
+ "description": "Wrap long log lines instead of truncating them to a single row.",
+ "type": "boolean"
+ }
+ },
+ "type": "object"
+ },
+ "description": {
+ "description": "New markdown description for the widget. Omit to leave unchanged.",
+ "type": "string"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "New display name for the widget. Empty string or null clears it; omit to leave unchanged."
+ },
+ "tile_id": {
+ "description": "ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.",
+ "type": "number"
+ },
+ "widget_type": {
+ "enum": ["logs_list"],
+ "type": "string"
+ }
+ },
+ "required": ["tile_id", "widget_type"],
+ "type": "object"
}
]
},
diff --git a/tach.toml b/tach.toml
index da1c2f5e9719..b5168f3d4f2c 100644
--- a/tach.toml
+++ b/tach.toml
@@ -206,6 +206,7 @@ depends_on = [
"products.error_tracking",
"products.experiments",
"products.feature_flags",
+ "products.logs",
"products.mcp_analytics",
"products.product_analytics",
]