Skip to content

Commit

Permalink
feat(pci-load-balancer): logs wip
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Renaut <[email protected]>
  • Loading branch information
frenautvh committed Oct 2, 2024
1 parent c10911a commit f3c04da
Show file tree
Hide file tree
Showing 19 changed files with 795 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/manager/apps/pci-load-balancer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@tanstack/react-query": "^5.50.1",
"@tanstack/react-query-devtools": "^5.50.1",
"@tanstack/react-table": "^8.17.3",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"i18next": "^23.11.5",
"i18next-http-backend": "^2.5.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Mehr erfahren",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "Im Folgenden finden Sie die Logs Ihres Loadbalancers für TCP-, HTTP-, HTTPS- und TERMINATED_HTTPS-Listener (UDP wird nicht unterstützt). Diese Logs werden von der Open-Source-Komponente HAProxy generiert.",
"octavia_load_balancer_data_streams_description_haproxy": "Wenn Sie die HAProxy-Logs Ihres Loadbalancers abonnieren, werden sie auf die Logs Data Platform übertragen. Sie können sie mit Ihren anderen Logs zentralisieren, erweiterte Suchvorgänge durchführen, ihre Aufbewahrung verwalten, Alarme definieren und Dashboards erstellen, um Ihre Anwendungen mit Loadbalancer zu überwachen."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Find out more",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "Below are the logs for your load balancer, separated into categories such as TCP, HTTP, HTTPS, and TERMINATED_HTTPS (please note that UDP is not supported). These logs are those generated by the HAProxy OpenSource component.",
"octavia_load_balancer_data_streams_description_haproxy": "By subscribing to your Load Balancer’s haproxy logs, they will be seamlessly transferred to the Logs Data Platform. You can centralise them with your other logs, conduct advanced searches, manage their retention, set alerts, and set up dashboards to monitor your applications using Load Balancers."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Más información",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "A continuación encontrará los logs de su Load Balancer para los «listeners» de tipo TCP, HTTP, HTTPS y TERMINATED_HTTPS (UDP no es compatible). Estos son los logs generados por el componente open source HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "Al suscribirse a los logs HAProxy de su Load Balancer, estos registros se transferirán a Logs Data Platform, desde donde podrá gestionarlos de forma centralizada junto con el resto de sus logs. Además, podrá realizar búsquedas más avanzadas, gestionar sus retenciones, definir alertas y «dashboards» para monitorizar sus aplicaciones que utilizan Load Balancers."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "En savoir plus",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "Vous trouverez ci-dessous les logs de votre load balancer pour les listeners de type TCP, HTTP, HTTPS & TERMINATED_HTTPS (UDP n'est pas supporté). Ces logs sont ceux générés par le composant OpenSource HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "En vous abonnant aux logs haproxy de votre Load Balancer, ils seront transférés dans Logs Data Platform et vous pourrez les centraliser avec vos autres logs, effectuer des recherches avancées, gérer leurs rétentions, définir des alertes ainsi que des tableaux de bord pour observer vos applications utilisant des Load Balancers."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "En savoir plus",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "Vous trouverez ci-dessous les logs de votre load balancer pour les listeners de type TCP, HTTP, HTTPS & TERMINATED_HTTPS (UDP n'est pas supporté). Ces logs sont ceux générés par le composant OpenSource HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "En vous abonnant aux logs haproxy de votre Load Balancer, ils seront transférés dans Logs Data Platform et vous pourrez les centraliser avec vos autres logs, effectuer des recherches avancées, gérer leurs rétentions, définir des alertes ainsi que des tableaux de bord pour observer vos applications utilisant des Load Balancers."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Scopri di più",
"octavia_load_balancer_logs_breadcrumb_label": "Log",
"octavia_load_balancer_logs_main_description": "Qui sotto sono disponibili i log del tuo Load Balancer per i listener di tipo TCP, HTTP, HTTPS &amp; TERMINATED_HTTPS (UDP non supportato). Questi log sono quelli generati dal componente OpenSource HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "Abbonandoti ai log haproxy del tuo Load Balancer, saranno trasferiti in Logs Data Platform e potrai centralizzarli con altri log, effettuare ricerche avanzate, gestire la loro retention, definire allarmi e creare dashboard per osservare le applicazioni che utilizzano i Load Balancer."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Dowiedz się więcej",
"octavia_load_balancer_logs_breadcrumb_label": "Logi",
"octavia_load_balancer_logs_main_description": "Poniżej znajdziesz logi Load Balancera dla nasłuchów TCP, HTTP, HTTPS i TERMINATED_HTTPS (UDP nie jest obsługiwany). Logi te są generowane przez komponent OpenSource HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "Po tym, jak zasubskrybujesz logi haproxy Load Balancera, zostaną one przeniesione do Logs Data Platform. Będziesz mógł je scentralizować z innymi logami, uruchamiać zaawansowane wyszukiwanie, zarządzać retencją, definiować alerty oraz dashboardy umożliwiające obserwację aplikacji korzystających z Load Balancerów."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"see_more_label": "Saber mais",
"octavia_load_balancer_logs_breadcrumb_label": "Logs",
"octavia_load_balancer_logs_main_description": "Encontrará abaixo os logs do seu Load Balancer para os “listeners” de tipo TCP, HTTP, HTTPS e TERMINATED_HTTPS (UDP não é suportado). Estes são os logs gerados pelo componente open source HAProxy.",
"octavia_load_balancer_data_streams_description_haproxy": "Ao subscrever os logs HAProxy do seu Load Balancer, estes registos serão transferidos para o Logs Data Platform, de onde poderá geri-los de forma centralizada com os seus outros logs. Além disso, poderá efetuar pesquisas mais avançadas, gerir as suas retenções, definir alertas, bem como painéis de controlo para monitorizar as aplicações que utilizam Load Balancers."
}
35 changes: 35 additions & 0 deletions packages/manager/apps/pci-load-balancer/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,38 @@ export const ACTION_LABELS = {
[ACTIONS.REDIRECT_PREFIX]: 'Redirect Prefix',
[ACTIONS.REJECT]: 'Reject',
};

export const LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK = {
DEFAULT:
'https://help.ovhcloud.com/csm/en-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062950',
FR:
'https://help.ovhcloud.com/csm/fr-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062936',
DE:
'https://help.ovhcloud.com/csm/de-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062949',
ES:
'https://help.ovhcloud.com/csm/es-es-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062945',
WE:
'https://help.ovhcloud.com/csm/en-ie-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062946',
IE:
'https://help.ovhcloud.com/csm/en-ie-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062946',
IT:
'https://help.ovhcloud.com/csm/it-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062940',
PL:
'https://help.ovhcloud.com/csm/pl-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062948',
PT:
'https://help.ovhcloud.com/csm/pt-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062947',
GB:
'https://help.ovhcloud.com/csm/en-gb-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062942',
CA:
'https://help.ovhcloud.com/csm/en-ca-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062943',
QC:
'https://help.ovhcloud.com/csm/fr-ca-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062944',
WS:
'https://help.ovhcloud.com/csm/es-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062941',
AU:
'https://help.ovhcloud.com/csm/en-au-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062939',
SG:
'https://help.ovhcloud.com/csm/en-sg-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062937',
ASIA:
'https://help.ovhcloud.com/csm/asia-public-cloud-network-loadbalancer-logs-forward?id=kb_article_view&sysparm_article=KB0062938',
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,78 @@
export default function Log() {
return <div>Log Page</div>;
import { useState } from 'react';
import { clsx } from 'clsx';
import { OsdsIcon, OsdsLink, OsdsText } from '@ovhcloud/ods-components/react';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import {
ODS_ICON_NAME,
ODS_ICON_SIZE,
ODS_TEXT_LEVEL,
ODS_TEXT_SIZE,
} from '@ovhcloud/ods-components';
import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core';
import { LogTiles } from '@ovh-ux/manager-pci-common';
import { Notifications, useMe } from '@ovh-ux/manager-react-components';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK } from '@/constants';

export default function LogsPage() {
const { t } = useTranslation('logs');
const { projectId, region, loadBalancerId } = useParams();
const [isFullscreen, setIsFullscreen] = useState(false);
const ovhSubsidiary = useMe()?.me?.ovhSubsidiary;
const infoLink =
LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK[ovhSubsidiary] ||
LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK.DEFAULT;

return (
<>
<Notifications />
<OsdsText
size={ODS_TEXT_SIZE._400}
level={ODS_TEXT_LEVEL.body}
color={ODS_THEME_COLOR_INTENT.text}
>
{t('octavia_load_balancer_logs_main_description')}{' '}
</OsdsText>
<OsdsLink
color={ODS_THEME_COLOR_INTENT.primary}
href={infoLink}
target={OdsHTMLAnchorElementTarget._blank}
>
{t('see_more_label')}
<span slot="end">
<OsdsIcon
aria-hidden="true"
className="ml-4"
name={ODS_ICON_NAME.EXTERNAL_LINK}
hoverable
size={ODS_ICON_SIZE.xxs}
color={ODS_THEME_COLOR_INTENT.primary}
/>
</span>
</OsdsLink>
<div
className={clsx(
'flex mt-4 md:h-[600px]',
isFullscreen ? 'flex-col' : 'flex-col md:flex-row',
)}
>
<div className={clsx(isFullscreen || 'w-full md:w-[68%] h-full')}></div>

<div
className={clsx(
isFullscreen ||
'w-full md:w-[32%] h-full overflow-y-auto mt-4 md:mt-0 ml-0 md:ml-4',
'min-h-0',
)}
>
<LogTiles
logsApiURL={`/cloud/project/${projectId}/region/${region}/loadbalancing/loadbalancer/${loadBalancerId}/log`}
logsKind="haproxy"
onGotoStreams={() => console.log('TODO')}
/>
</div>
</div>
</>
);
}
1 change: 0 additions & 1 deletion packages/manager/modules/manager-pci-common/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
Expand Down
82 changes: 82 additions & 0 deletions packages/manager/modules/manager-pci-common/src/api/data/logs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { Filter, fetchIcebergV6, v6 } from '@ovh-ux/manager-core-api';
import { PaginationState } from '@ovh-ux/manager-react-components';

export type TDbaasLog = {
createdAt: string;
displayName?: string;
iam?: {
displayName?: string;
id: string;
tags?: Record<string, string>;
urn: string;
};
isClusterOwner: boolean;
plan: 'ENTERPRISE' | 'STANDARD';
serviceName: string;
state: 'DISABLED' | 'ENABLED' | 'INIT' | 'TO_CONFIG';
updatedAt?: string;
username: string;
};

export async function getDbaasLogs() {
const { data } = await fetchIcebergV6<TDbaasLog>({
route: `/dbaas/logs`,
disableCache: true,
});
return data;
}

export type TDbaasStream = {
canAlert: boolean;
clusterId: string;
createdAt: string;
description: string;
isEditable: boolean;
title: string;
updatedAt: string;
retentionId: string;
streamId: string;
indexingEnabled: boolean;
nbSubscription: number;
};

export async function getStream(serviceName: string, streamId: string) {
const { data } = await v6.get<TDbaasStream>(
`/dbaas/logs/${serviceName}/output/graylog/stream/${streamId}`,
);
return data;
}

export async function getStreamsIds(serviceName: string) {
const { data } = await v6.get<TDbaasStream>(
`/dbaas/logs/${serviceName}/output/graylog/stream`,
);
return data;
}

export async function getStreams(
serviceName: string,
pagination: PaginationState,
filters: Filter[],
) {
const { data, totalCount } = await fetchIcebergV6<TDbaasStream>({
route: `/dbaas/logs/${serviceName}/output/graylog/stream`,
page: pagination.pageIndex,
pageSize: pagination.pageSize,
filters,
disableCache: true,
});
return { data, totalCount };
}

export type TStreamURL = {
address: string;
type: string;
};

export async function getStreamURL(serviceName: string, streamId: string) {
const { data } = await v6.get<TStreamURL[]>(
`/dbaas/logs/${serviceName}/output/graylog/stream/${streamId}/url`,
);
return data;
}
Loading

0 comments on commit f3c04da

Please sign in to comment.