Audit logs track and store authorization activities in Pulsar clusters, tenants, namespaces, and topics. After a Pulsar cluster is up and running within a large team, it's critical to keep an eye on who is touching data and what they're doing with it. Structured audit logs provide an easy way to track user/application access, so you can identify potential anomalies and bad actors.
Structured audit logs enable you to capture audit logs in a set of dedicated Pulsar topics, either on a local or a remote cluster, including:
- low-volume, management-related activities, such as creating or deleting tenants, namespaces or topics
- high-volume activities, such as produce, consume, and acknowledge events
Because the audit logs are stored in a Pulsar topic, you should configure the cleanup and backlog policy for the namespace to avoid having the Pulsar retention policies inadvertently clean up the audit logs. For more information, see Configure policies for a namespace.
Configure audit log
If you did not enable audit log when you set up your cluster, or if you want to change the settings, follow these steps.
- Log in to StreamNative Cloud Console.
- On the left navigation pane, in the Admin area, click Pulsar Clusters.
- Click Edit Cluster.
- If it is not already selected, click Advanced.
- Toggle the Audit Log option on.
- Select the types of audit logs you want to enable. For details about the types of events that you can enable, see event type.
- Click Finish to apply your changes and return to the Clusters page.
Check the audit log status
To verify that audit log is running, on the left navigation pane of StreamNative Cloud Console, in the Admin area, click Pulsar Clusters. You can verify that the audit log is running, as shown in the following figure.
Each audit log includes information about the event, event time, and permission status. The supported audit event types include:
|Category||Type||Event type||Description||Default value|
|Management||Cluster||Create a Pulsar cluster.||true|
|Cluster||Update Pulsar cluster information.||true|
|Cluster||Delete Pulsar cluster information.||true|
|Tenant||Create a Pulsar tenant.||true|
|Tenant||Update tenant information.||true|
|Tenant||Delete a Pulsar tenant.||true|
|Namespace||Create a namespace.||true|
|Namespace||Delete a namespace.||true|
|Topic||Create a partitioned topic.||true|
|Topic||Update partitions for a partitioned topic.||true|
|Topic||Delete a partitioned topic.||true|
|Subscription||Create a subscription.||true|
|Subscription||Delete a subscription.||true|
|Describe||Cluster||List Pulsar clusters.||false|
|Cluster||Get cluster information.||false|
|Tenant||List Pulsar tenants.||false|
|Tenant||Get tenant information.||false|
|Namespace||List Pulsar namespaces.||false|
|Namespace||Get namespace information.||false|
|Topic||List Pulsar topics.||false|
|Topic||List partitioned Pulsar topics.||false|
|Topic||Get partitions of a partitioned topic.||false|
|Subscription||List subscriptions of a topic.||false|
|Produce||Producer||Create a producer to produce messages to the topic.||false|
|Producer||Close a producer.||false|
|Consume||Consumer||Create a consumer to subscribe to the topic.||false|
|Consumer||Close a consumer.||false|
Work with audit log
You can use Pulsar clients, Pulsar CLI, Rest API, and sink connectors to process and analyze the audit events stored in the Pulsar topics.
Consume the audit log topic with Pulsar clients
You can get data from the audit log topic with Pulsar clients. Refer to the Connect section to learn how to configure Pulsar clients for StreamNative Cloud cluster and consume data from the audit log topic.
Consume the audit log topic with Pulsar CLI
The pulsar-client is also a helpful tool to get data from the audit log topic. For more information, see pulsar-client to learn how to configure
pulsar-client for StreamNative Cloud cluster and consume data from the audit log topic.
Consume the audit log topic with Rest API
StreamNative Cloud supports Rest API, which provides a RESTful interface to a Pulsar cluster. For more information, see Rest API to learn how to leverage the Rest API to consume data from the audit log topic.
Sink audit log topic with connectors
If you want to integrate audit log data with your other data systems like Google BigQuery, AWS SQS, and AWS Kinesis, use a sink connector. For more information, see sink connectors to learn how to leverage sink connectors to integrate and synchronize audit log data.