Build an audit log system in your SaaS product

Learn to create a reliable audit log in your SaaS using Operational to track key user actions securely.

What is an audit log system in SaaS?

An audit log system records key actions that users or admins perform in your application.

It helps with debugging, security audits and compliance.

For example, when a user updates billing settings, you store a record of who did what and when.

Using Operational to track audit events

Operational is an open-source tracking platform for tech products.

You can send events from your code and view them in a dashboard.

You can filter by event name, date or user. It helps you investigate issues faster.

Setting up Operational

  1. Sign up at app.operational.co.
  2. Create a new project and copy your API key.
  3. Install the SDK in your project with
npm install @operational.co/sdk.
  1. Keep your API key safe and add it to your environment variables.

Code examples

Pepper this code in your SaaS’s backend. We’re using nodejs for the code examples.

import Operational from "@operational.co/sdk";
const ops = new Operational("API_KEY");

// Example 1: Account creation
const payload1 = {
  name: "account created",
  avatar: "",
  content: "User John Smith created a new account"
};
await ops.events.ingest(payload1);

// Example 2: Password change
const payload2 = {
  name: "password changed",
  avatar: "🔒",
  content: "User Jane Doe updated her password"
};
await ops.events.ingest(payload2);

// Example 3: Account deletion
const payload3 = {
  name: "account deleted",
  avatar: "🗑️",
  content: "User Mark Lee deleted their account"
};
await ops.events.ingest(payload3);

// Example 4: Billing update
const payload4 = {
  name: "billing updated",
  avatar: "💳",
  content: "User Alex Kim changed billing information"
};
await ops.events.ingest(payload4);

This code shows how to send different audit events to Operational for tracking and review.

Conclusion

Operational saves time and hassle by handling event ingestion, storage and inspection.

You get a ready dashboard and filters to view your audit logs.

Learn more at https://operational.co.

Try it in the playground: https://operational.co/playground.