Indent enables you to easily collect audit logs from your Website.
In your HTML file, add the following code above your </body>
tag:
<script src="https://cdn.indent.com/v1/js/audit.js" data-input-dsn="https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl" ></script>
Then in your code, you can write audit events like this:
Indent.audit.write({ actor: { id: 'h0cECutqz', email: 'jane.doe@example.com' }, event: 'page_viewed', resources: [ { kind: 'http/url', id: window.location.href } ] })
If you have a website that uses modern JavaScript patterns like using Webpack, Parcel or Babel then you can use Indent through our JavaScript SDK:
yarn add @indent/audit npm i -S @indent/audit
Then you can import the SDK in your code like this:
// ES Modules import { audit } from '@indent/audit' // CommonJS (e.g. older build systems and versions of Node.js) const { audit } = require('@indent/audit')
At the root of your application, initialize the SDK with your INPUT_DSN
:
audit.init({ dsn: 'https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl' })
Now you can write audit logs from anywhere in your application:
import { audit } from '@indent/audit' audit.write({ actor: { id: 'h0cECutqz', email: 'jane.doe@example.com' }, event: 'alarm.delete', resources: [ { kind: 'alarm', id: 'very-important-alarm', altIds: ['owner/infra-ops@example.com'] } ] })