Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/util/db-schema/central-log.ts
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Table } from "./types";67Table({8name: "central_log",9fields: {10id: {11type: "uuid",12desc: "Random id for this event",13},14event: {15type: "string",16desc: "Event name which must start with 'webapp-' to not conflict with other names that might be used already (e.g., by the backend).",17},18value: {19type: "map",20desc: "Any JSON-type data for this event",21},22time: {23type: "timestamp",24desc: "When the event took place",25},26expire: {27type: "timestamp",28desc: "future date, when the entry will be deleted",29},30},31rules: {32desc: "Table for logging system stuff that happens. Meant for analytics, to help in running and understanding CoCalc better. Not read by the frontend clients at all, except admins.",33primary_key: "id",34durability: "soft", // loss of some log data not serious, since used only for analytics35pg_indexes: ["time", "event"],36user_query: {37get: {38admin: true,39fields: {40id: null,41event: null,42value: null,43time: null,44},45},46set: {47fields: {48id: true,49event: true,50value: true,51time: true,52},53check_hook: (_db, query, _account_id, _project_id, cb): void => {54if (!query.event.startsWith("webapp-")) {55cb("event must start with 'webapp-'");56} else {57cb();58}59},60},61},62},63});646566