feat: Enhance DashboardLogStreamComponent with attribute filtering and update CustomDomains description

This commit is contained in:
Nawaz Dhandala
2026-03-26 16:35:37 +00:00
parent 5601cc5591
commit c92e259978
5 changed files with 33 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import InBetween from "Common/Types/BaseDatabase/InBetween";
import SortOrder from "Common/Types/BaseDatabase/SortOrder";
import OneUptimeDate from "Common/Types/Date";
import Query from "Common/Types/BaseDatabase/Query";
import { queryStringToFilter, LogFilter } from "Common/Types/Log/LogQueryToFilter";
export interface ComponentProps extends DashboardBaseComponentProps {
component: DashboardLogStreamComponent;
@@ -99,6 +100,21 @@ const DashboardLogStreamComponentElement: FunctionComponent<ComponentProps> = (
props.component.arguments.bodyContains.trim();
}
// Add attribute filters if set
if (
props.component.arguments.attributeFilterQuery &&
props.component.arguments.attributeFilterQuery.trim() !== ""
) {
const parsedFilter: LogFilter = queryStringToFilter(
props.component.arguments.attributeFilterQuery.trim(),
);
if (parsedFilter.attributes) {
(query as Record<string, unknown>)["attributes"] =
parsedFilter.attributes;
}
}
const listResult: ListResult<Log> =
await AnalyticsModelAPI.getList<Log>({
modelType: Log,
@@ -112,6 +128,7 @@ const DashboardLogStreamComponentElement: FunctionComponent<ComponentProps> = (
serviceId: true,
traceId: true,
spanId: true,
attributes: true,
},
sort: {
time: SortOrder.Descending,
@@ -137,6 +154,7 @@ const DashboardLogStreamComponentElement: FunctionComponent<ComponentProps> = (
}, [
props.component.arguments.severityFilter,
props.component.arguments.bodyContains,
props.component.arguments.attributeFilterQuery,
props.component.arguments.maxRows,
]);

View File

@@ -69,7 +69,7 @@ const DashboardCustomDomains: FunctionComponent<PageComponentProps> = (
isEditable={true}
cardProps={{
title: "Custom Domains",
description: `Important: Please add ${StatusPageCNameRecord} as your CNAME for these domains for this to work.`,
description: `Important: Please add a CNAME record pointing to ${StatusPageCNameRecord} for these domains for this to work.`,
}}
refreshToggle={refreshToggle}
onBeforeCreate={(

View File

@@ -9,6 +9,7 @@ export default interface DashboardLogStreamComponent extends BaseComponent {
title?: string | undefined;
severityFilter?: string | undefined;
bodyContains?: string | undefined;
attributeFilterQuery?: string | undefined;
maxRows?: number | undefined;
};
}

View File

@@ -67,6 +67,16 @@ export default class DashboardLogStreamComponentUtil extends DashboardBaseCompon
placeholder: "Search text...",
});
componentArguments.push({
name: "Attribute Filters",
description:
"Filter logs by attributes using @key:value syntax. For example: @k8s.pod.name:my-pod @http.status_code:500",
required: false,
type: ComponentInputType.LongText,
id: "attributeFilterQuery",
placeholder: "@key:value @another.key:value",
});
componentArguments.push({
name: "Max Rows",
description: "Maximum number of log entries to display",

View File

@@ -36,11 +36,12 @@ GLOBAL_PROBE_2_KEY=probe-2-please-change-this-to-random-value
STATUS_PAGE_HTTPS_PORT=443
# If you would like to attach status page to custom domains use this setting.
# For example, lets say you would like the status page to be hosted on status.yourcompany.com, then
# If you would like to attach status pages or public dashboards to custom domains use this setting.
# For example, lets say you would like the status page to be hosted on status.yourcompany.com, then
# 1. Create a A record in your DNS provider with the name "oneuptime.yourcompany.com" and value to Public IP of the server oneuptime is deployed on.
# 2. Set the STATUS_PAGE_CNAME_RECORD to "oneuptime.yourcompany.com"
# 3. Create CNAME record in your DNS provider with the name "status.yourcompany.com" and value "oneuptime.yourcompany.com"
# This same CNAME is used for both status page and public dashboard custom domains.
STATUS_PAGE_CNAME_RECORD=oneuptime.yourcompany.com