diff --git a/web/packages/teleport/src/Audit/EventList/EventList.tsx b/web/packages/teleport/src/Audit/EventList/EventList.tsx
index 391ea93626f4c..4b6e5f8321622 100644
--- a/web/packages/teleport/src/Audit/EventList/EventList.tsx
+++ b/web/packages/teleport/src/Audit/EventList/EventList.tsx
@@ -98,8 +98,13 @@ export const renderTimeCell = ({ time }: Event) => (
{time.toISOString()} |
);
-export function renderDescCell({ message }: Event) {
- return {message} | ;
+export function renderDescCell(event: Event) {
+ const { message, render } = event;
+ return (
+
+ {render ? render(event.raw) : message}
+ |
+ );
}
type Props = {
diff --git a/web/packages/teleport/src/services/audit/makeEvent.ts b/web/packages/teleport/src/services/audit/makeEvent.tsx
similarity index 98%
rename from web/packages/teleport/src/services/audit/makeEvent.ts
rename to web/packages/teleport/src/services/audit/makeEvent.tsx
index 2a2bf26a3ba5e..cea8debdf912c 100644
--- a/web/packages/teleport/src/services/audit/makeEvent.ts
+++ b/web/packages/teleport/src/services/audit/makeEvent.tsx
@@ -18,9 +18,15 @@
import { formatDistanceStrict } from 'date-fns';
import { pluralize } from 'shared/utils/text';
+import * as Icons from 'design/Icon';
import { Event, RawEvent, Formatters, eventCodes, RawEvents } from './types';
+const iconProps = {
+ m: 1,
+ verticalAlign: 'middle',
+};
+
const formatElasticsearchEvent: (
json:
| RawEvents[typeof eventCodes.ELASTICSEARCH_REQUEST]
@@ -725,6 +731,12 @@ export const formatters: Formatters = {
type: 'user.login',
desc: 'Local Login',
format: ({ user }) => `Local user [${user}] successfully logged in`,
+ render: ({ user }) => (
+ <>
+ Local user
+ {user} successfully logged in
+ >
+ ),
},
[eventCodes.USER_LOCAL_LOGINFAILURE]: {
type: 'user.login',
@@ -783,11 +795,31 @@ export const formatters: Formatters = {
}
return `Passwordless user requested an MFA authentication challenge`;
},
+ render: ({ user }) => {
+ if (user) {
+ return (
+ <>
+
+ {user} requested an MFA authentication challenge
+ >
+ );
+ } else {
+ return (
+ <>`Passwordless user requested an MFA authentication challenge`;>
+ );
+ }
+ },
},
[eventCodes.VALIDATE_MFA_AUTH_RESPONSE]: {
type: 'mfa_auth_challenge.validate',
desc: 'MFA Authentication Success',
format: ({ user }) => `User [${user}] completed MFA authentication`,
+ render: ({ user }) => (
+ <>
+
+ {user} completed MFA authentication
+ >
+ ),
},
[eventCodes.VALIDATE_MFA_AUTH_RESPONSEFAILURE]: {
type: 'mfa_auth_challenge.validate',
@@ -1441,6 +1473,24 @@ export const formatters: Formatters = {
}
return `Certificate of type [${cert_type}] issued for [${user}]`;
},
+ render: ({ cert_type, identity: { user } }) => {
+ if (cert_type === 'user') {
+ return (
+ <>
+ User certificate issued for{' '}
+
+ {user}
+ >
+ );
+ }
+ return (
+ <>
+ Certificate of type {cert_type} issued for{' '}
+
+ {user}
+ >
+ );
+ },
},
[eventCodes.UPGRADE_WINDOW_UPDATED]: {
type: 'upgradewindow.update',
@@ -1995,6 +2045,7 @@ export default function makeEvent(json: any): Event {
user: json.user,
time: new Date(json.time),
raw: json,
+ render: formatter.render,
};
}
diff --git a/web/packages/teleport/src/services/audit/types.ts b/web/packages/teleport/src/services/audit/types.ts
index 3a52afb6617f5..efe01da52adbb 100644
--- a/web/packages/teleport/src/services/audit/types.ts
+++ b/web/packages/teleport/src/services/audit/types.ts
@@ -1954,6 +1954,7 @@ export type Formatters = {
type: string;
desc: string;
format: (json: RawEvents[key]) => string;
+ render?: (e: RawEvents[key]) => JSX.Element;
};
};
@@ -1966,6 +1967,7 @@ export type Events = {
code: key;
codeDesc: string;
raw: RawEvents[key];
+ render?: (e: RawEvents[key]) => JSX.Element;
};
};