Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: show milliseconds in timestamp in logs views (#4949)

Yunus M64bf58032379
diff --git a/frontend/src/components/Logs/ListLogView/index.tsx b/frontend/src/components/Logs/ListLogView/index.tsx
index 2b828d663c..47b108e944 100644
--- a/frontend/src/components/Logs/ListLogView/index.tsx
+++ b/frontend/src/components/Logs/ListLogView/index.tsx
@@ -157,8 +157,8 @@ function ListLogView({
const timestampValue = useMemo(
() =>
typeof flattenLogData.timestamp === 'string'
- ? dayjs(flattenLogData.timestamp).format()
- : dayjs(flattenLogData.timestamp / 1e6).format(),
+ ? dayjs(flattenLogData.timestamp).format('YYYY-MM-DD HH:mm:ss.SSS')
+ : dayjs(flattenLogData.timestamp / 1e6).format('YYYY-MM-DD HH:mm:ss.SSS'),
[flattenLogData.timestamp],
);
diff --git a/frontend/src/components/Logs/RawLogView/index.tsx b/frontend/src/components/Logs/RawLogView/index.tsx
index 099e0fcc25..712b97723d 100644
--- a/frontend/src/components/Logs/RawLogView/index.tsx
+++ b/frontend/src/components/Logs/RawLogView/index.tsx
@@ -90,12 +90,12 @@ function RawLogView({
const text = useMemo(
() =>
typeof data.timestamp === 'string'
- ? `${dayjs(data.timestamp).format()} | ${attributesText} ${severityText} ${
- data.body
- }`
- : `${dayjs(
- data.timestamp / 1e6,
- ).format()} | ${attributesText} ${severityText} ${data.body}`,
+ ? `${dayjs(data.timestamp).format(
+ 'YYYY-MM-DD HH:mm:ss.SSS',
+ )} | ${attributesText} ${severityText} ${data.body}`
+ : `${dayjs(data.timestamp / 1e6).format(
+ 'YYYY-MM-DD HH:mm:ss.SSS',
+ )} | ${attributesText} ${severityText} ${data.body}`,
[data.timestamp, data.body, severityText, attributesText],
);
diff --git a/frontend/src/components/Logs/TableView/useTableView.tsx b/frontend/src/components/Logs/TableView/useTableView.tsx
index 259e046370..be34e998ef 100644
--- a/frontend/src/components/Logs/TableView/useTableView.tsx
+++ b/frontend/src/components/Logs/TableView/useTableView.tsx
@@ -76,8 +76,8 @@ export const useTableView = (props: UseTableViewProps): UseTableViewResult => {
render: (field, item): ColumnTypeRender<Record<string, unknown>> => {
const date =
typeof field === 'string'
- ? dayjs(field).format()
- : dayjs(field / 1e6).format();
+ ? dayjs(field).format('YYYY-MM-DD HH:mm:ss.SSS')
+ : dayjs(field / 1e6).format('YYYY-MM-DD HH:mm:ss.SSS');
return {
children: (
<div className="table-timestamp">
diff --git a/frontend/src/container/LogControls/index.tsx b/frontend/src/container/LogControls/index.tsx
index eda7f89c33..5360168b10 100644
--- a/frontend/src/container/LogControls/index.tsx
+++ b/frontend/src/container/LogControls/index.tsx
@@ -85,8 +85,8 @@ function LogControls(): JSX.Element | null {
logs.map((log) => {
const timestamp =
typeof log.timestamp === 'string'
- ? dayjs(log.timestamp).format()
- : dayjs(log.timestamp / 1e6).format();
+ ? dayjs(log.timestamp).format('YYYY-MM-DD HH:mm:ss.SSS')
+ : dayjs(log.timestamp / 1e6).format('YYYY-MM-DD HH:mm:ss.SSS');
return FlatLogData({
...log,
diff --git a/frontend/src/container/LogsExplorerViews/index.tsx b/frontend/src/container/LogsExplorerViews/index.tsx
index 2208fb2151..622de9ba83 100644
--- a/frontend/src/container/LogsExplorerViews/index.tsx
+++ b/frontend/src/container/LogsExplorerViews/index.tsx
@@ -531,8 +531,8 @@ function LogsExplorerViews({
logs.map((log) => {
const timestamp =
typeof log.timestamp === 'string'
- ? dayjs(log.timestamp).format()
- : dayjs(log.timestamp / 1e6).format();
+ ? dayjs(log.timestamp).format('YYYY-MM-DD HH:mm:ss.SSS')
+ : dayjs(log.timestamp / 1e6).format('YYYY-MM-DD HH:mm:ss.SSS');
return FlatLogData({
timestamp,