Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors

Audit Log

The audit log records actions that users perform on platform entities — devices, assets, dashboards, rule chains, customers, users, and more. Each record shows who performed the action, on which entity, when it happened, and whether it succeeded. Use the audit log to monitor activity, investigate incidents, and support security and compliance reviews.

The audit log records actions that users perform through the UI or the REST API, including actions that fail with an error. Requests refused for lack of permission are generally not recorded. The exception is creating or updating a device, asset, entity view, customer, or dashboard: a refused attempt is recorded as a failed Added or Updated.

  • Entities. Creating, updating, and deleting entities.
  • Ownership and groups. Assigning entities to customers, edges, or groups, changing their owner, and making groups public or private.
  • Relations. Adding, updating, and deleting relations, recorded on both related entities.
  • Data. Updating or deleting attributes and telemetry, sending RPC commands, and calling the rule engine REST API.
  • Alarms. Creating, updating, acknowledging, clearing, assigning, unassigning, commenting on, and deleting alarms. Acknowledging, clearing, assigning, or unassigning an alarm also adds a system comment, recorded as a separate Added comment record.
  • Sign-in. Logins and explicit logouts; an expired session isn’t recorded. A wrong password or two-factor authentication code is recorded as a Login with status Failure. When too many wrong passwords lock the account, a Lockout record is added as well. Login attempts with an email that doesn’t exist aren’t recorded. SMS messages sent for two-factor authentication are recorded as SMS sent.

It doesn’t record what happens without a user: telemetry and attributes that devices send over MQTT, HTTP, CoAP, or other transports, and changes made by rule nodes, integrations, scheduled events, or calculated fields. The exception is device provisioning, which is recorded with the device name in the User column.

Requests made with an API key are recorded under the email of the user who owns the key. Creating or deleting API keys isn’t recorded.

The audit log only stores records; it doesn’t send alerts. To be notified when entities are created, updated, or deleted, use a notification rule with the Entity action trigger.

Open Security ⇾ Audit logs from the left-hand menu. The page lists records from the selected time range (by default, the last day), with the most recent first.

  • Tenant administrators see the records of the whole tenant.
  • Customer users see the records of their customer: actions of the customer’s own users, and entity actions (such as create, update, delete, assign, and alarm actions) on the customer’s entities, including those made by tenant administrators. Attribute, telemetry, and RPC actions of tenant administrators, failed actions of tenant administrators, and records of sub-customers are not included.

System administrators see only the records of system administrators’ own actions, such as logins, tenant profile changes, and changes to tenant administrator accounts. Creating, updating, or deleting tenants is not recorded, and tenants’ records are not shown.

Each row is one record. Click a column header to sort by it.

Column Description
Timestamp When the action occurred.
Entity type The type of entity acted upon, for example Device, Asset, Dashboard, Rule chain, Customer, or User. Alarm actions, except comments, are recorded against the alarm’s originator, so they show its type, for example Device. Alarm comments show Alarm.
Entity name The name of the entity. For a created or updated alarm and for alarm comments, the alarm type; for other alarm actions, the originator’s name.
User The email of the user who performed the action, or the device name for device provisioning.
Type The action performed, for example Added, Updated, Deleted, Assigned to Customer, or Login.
Status Success or Failure.

Use the controls above the table to narrow down the list:

  • Time range — click the time range button (for example, last 1 day) to choose a preset period or a custom date range.
  • Audit log filter — show only selected Audit log types, for example Login or Deleted.
  • Search — click the search icon and enter text. The search runs on the server, ignores case, and matches part of the entity name, user, entity type, type, or status. Entity type, type, and status are matched by their stored names, such as RULE_CHAIN, ASSIGNED_TO_CUSTOMER, or FAILURE: search for rule_chain, not Rule chain. Searching for a user’s email returns the user’s own actions and also actions on that user’s account.
  • Refresh — reload the list using the current time range and filters.

Click the Details button (⋅⋅⋅) at the end of a row. The Audit log details dialog shows the Action data: the JSON payload of the action. What it contains depends on the action:

  • Added and Updated — the entity as saved, that is, its state after the action. Dashboard records leave out the dashboard configuration.
  • Login, Logout, and Lockout — the client IP address, browser, operating system, and device, plus, for OAuth 2.0 logins, the name of the OAuth 2.0 client used.
  • Deleted — only the entity ID.
  • Other actions store their own details, for example the customer an entity was assigned to, the attribute keys and values, or the RPC method and parameters.

For a failed action, the dialog also shows the Failure details.

A record holds only the state after the action. To see what an update changed, compare its Action data with the entity’s previous Added or Updated record, for example on the entity’s Audit logs tab.

Most entity details pages have an Audit logs tab with the records of that entity: devices, assets, entity views, dashboards, edges, customers, users, device and asset profiles, rule chains, integrations, data converters, JavaScript library resources, roles, report templates, and entity groups. For system administrators, tenant profiles have it too.

  • On most entities, the tab shows actions on that entity, including actions on alarms it originated, except alarm comments.
  • On a customer, it shows the records of that customer, as described in Open the Audit Log.
  • On a user, it shows actions on the user account, such as updates, logins, failed logins, lockouts, and logouts — not the user’s actions on other entities. To see those, search for the user’s email on the Audit logs page, or use GET /api/audit/logs/user/{userId} (see REST API).

Failed attempts to create, update, or delete an entity aren’t linked to the entity, so they appear only on the Audit logs page. Failed logins, failed attribute or telemetry changes, and failed RPC calls do appear on the entity’s or user’s tab.

All audit log endpoints are GET requests that return records page by page:

Endpoint Returns
/api/audit/logs All records the caller can see: the tenant’s, or the customer’s for customer users
/api/audit/logs/entity/{entityType}/{entityId} Actions on one entity
/api/audit/logs/customer/{customerId} The records of one customer
/api/audit/logs/user/{userId} Actions performed by one user

System administrators can use only /api/audit/logs and /api/audit/logs/entity/{entityType}/{entityId}.

All endpoints take these parameters:

  • Required: pageSize and page (zero-based).
  • Optional: startTime and endTime (in milliseconds), actionTypes (a comma-separated list, for example LOGIN,LOCKOUT), textSearch, sortProperty (createdTime, entityType, entityName, userName, actionType, or actionStatus), and sortOrder (ASC or DESC).

Unlike the UI, the API returns all records up to now when startTime and endTime are omitted, and without sortProperty the records aren’t in time order: pass sortProperty=createdTime&sortOrder=DESC to get the newest first. See the REST API reference for details.

Audit logging is configured in thingsboard.yml or through the matching environment variables:

# Audit log parameters
# Enables audit logging, configures per-entity-type logging levels, and optionally exports logs to an external sink such as Elasticsearch.
audit-log:
# Enable/disable audit log functionality.
enabled: "${AUDIT_LOG_ENABLED:true}"
# Logging levels per each entity type.
# Allowed values: OFF (disable), W (log write operations), RW (log read and write operations)
logging-level:
mask:
"device": "${AUDIT_LOG_MASK_DEVICE:W}" # Device logging levels.
"asset": "${AUDIT_LOG_MASK_ASSET:W}" # Asset logging levels.
"dashboard": "${AUDIT_LOG_MASK_DASHBOARD:W}" # Dashboard logging levels.
"widget_type": "${AUDIT_LOG_MASK_WIDGET_TYPE:W}" # Widget type logging levels.
"widgets_bundle": "${AUDIT_LOG_MASK_WIDGETS_BUNDLE:W}" # Widget bundles logging levels.
"customer": "${AUDIT_LOG_MASK_CUSTOMER:W}" # Customer logging levels.
"user": "${AUDIT_LOG_MASK_USER:W}" # User logging levels.
"rule_chain": "${AUDIT_LOG_MASK_RULE_CHAIN:W}" # Rule chain logging levels.
"alarm": "${AUDIT_LOG_MASK_ALARM:W}" # Alarm logging levels.
"integration": "${AUDIT_LOG_MASK_INTEGRATION:W}" # Integration logging levels.
"converter": "${AUDIT_LOG_MASK_CONVERTER:W}" # Converter logging levels.
"entity_group": "${AUDIT_LOG_MASK_ENTITY_GROUP:W}" # Entity Group logging levels.
"scheduler_event": "${AUDIT_LOG_MASK_SCHEDULER_EVENT:W}" # Scheduler Event logging levels.
"blob_entity": "${AUDIT_LOG_MASK_BLOB_ENTITY:W}" # Blob entity logging levels.
"entity_view": "${AUDIT_LOG_MASK_ENTITY_VIEW:W}" # Entity view logging levels.
"device_profile": "${AUDIT_LOG_MASK_DEVICE_PROFILE:W}" # Device profile logging levels.
"asset_profile": "${AUDIT_LOG_MASK_ASSET_PROFILE:W}" # Asset profile logging levels.
"edge": "${AUDIT_LOG_MASK_EDGE:W}" # Edge logging levels.
"tb_resource": "${AUDIT_LOG_MASK_RESOURCE:W}" # TB resource logging levels.
"ota_package": "${AUDIT_LOG_MASK_OTA_PACKAGE:W}" # Ota package logging levels.
"calculated_field": "${AUDIT_LOG_MASK_CALCULATED_FIELD:W}" # Calculated field logging levels.
"ai_model": "${AUDIT_LOG_MASK_AI_MODEL:W}" # AI model logging levels.
"role": "${AUDIT_LOG_MASK_ROLE:W}" # Roles logging levels.
"group_permission": "${AUDIT_LOG_MASK_GROUP_PERMISSION:W}" # Group permission logging levels.
"report_template": "${AUDIT_LOG_MASK_REPORT_TEMPLATE:W}" # Report template logging levels.
sink:
# Type of external sink. possible options: none, elasticsearch
type: "${AUDIT_LOG_SINK_TYPE:none}"
# Name of the index where audit logs are stored
# Index name could contain next placeholders (not mandatory):
# @{TENANT} - substituted by tenant ID
# @{DATE} - substituted by current date in format provided in audit_log.sink.date_format
index_pattern: "${AUDIT_LOG_SINK_INDEX_PATTERN:@{TENANT}_AUDIT_LOG_@{DATE}}"
# Date format. Details of the pattern can be found here:
# https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
date_format: "${AUDIT_LOG_SINK_DATE_FORMAT:YYYY.MM.dd}"
scheme_name: "${AUDIT_LOG_SINK_SCHEME_NAME:http}" # http or https
host: "${AUDIT_LOG_SINK_HOST:localhost}" # Host of external sink system
port: "${AUDIT_LOG_SINK_PORT:9200}" # Port of external sink system
user_name: "${AUDIT_LOG_SINK_USER_NAME:}" # Username used to access external sink system
password: "${AUDIT_LOG_SINK_PASSWORD:}" # Password used to access external sink system

enabled (AUDIT_LOG_ENABLED, true by default) turns audit logging on or off. When it’s false, nothing is recorded, and existing records are hidden too: the Audit logs page, the entity tabs, and the REST API return nothing. The cleanup described in Storage and Retention keeps running.

The logging-level.mask section sets the logging level for each entity type, through the AUDIT_LOG_MASK_<TYPE> environment variables (for tb_resource, AUDIT_LOG_MASK_RESOURCE):

Level Description
OFF Logging disabled for this entity type.
W Log write actions, for example create, update, delete, and login.
RW Also log the two read actions: Credentials read and Attributes read.

Every entity type in the mask defaults to W. For tenant and customer users, entity types that aren’t listed in the mask, such as secrets, OAuth 2.0 clients, domains, mobile apps, and agents, aren’t logged at all. Write actions of system administrators, such as logins and tenant profile changes, are always logged, whatever the mask says.

Records are filed under the entity they concern, so the mask of that entity type applies:

  • Login, logout, and lockout records belong to the user, so AUDIT_LOG_MASK_USER controls them.
  • Alarm actions belong to the alarm’s originator, so the originator’s mask applies; the alarm mask covers alarm comments and failed attempts to create or update an alarm.

Audit log records are stored in partitions in the SQL database. With SPRING_DEDICATED_EVENTS_DATASOURCE_ENABLED=true, they’re stored in the separate events database instead. These parameters are in the sql section of thingsboard.yml:

sql.audit_logs.partition_size · SQL_AUDIT_LOGS_PARTITION_SIZE_HOURS · Default 168

Partition size in hours (one week by default).

sql.ttl.audit_logs.enabled · SQL_TTL_AUDIT_LOGS_ENABLED · Default true

Enables the cleanup of old audit log records. Cleanup runs only when ttl is greater than 0.

sql.ttl.audit_logs.ttl · SQL_TTL_AUDIT_LOGS_SECS · Default 0

How long to keep records, in seconds. 0 keeps them forever. Records are removed a whole partition at a time, so the cleanup is only as precise as the partition size.

sql.ttl.audit_logs.checking_interval_ms · SQL_TTL_AUDIT_LOGS_CHECKING_INTERVAL_MS · Default 86400000

How often the cleanup runs, in milliseconds (once a day by default).

Records can also be sent to Elasticsearch. Sending is best effort: if it fails, the record stays in the database and the server only logs the error. The index name is converted to lower case.

To enable it, set type (AUDIT_LOG_SINK_TYPE) to elasticsearch and the connection parameters shown in the YAML above: scheme_name, host, port, user_name, and password. Two parameters need more explanation:

index_pattern · AUDIT_LOG_SINK_INDEX_PATTERN · Default @{TENANT}_AUDIT_LOG_@{DATE}

Index name pattern. Supports @{TENANT} (tenant ID) and @{DATE} (current date) placeholders.

date_format · AUDIT_LOG_SINK_DATE_FORMAT · Default YYYY.MM.dd

Date format for the @{DATE} placeholder. Uses Java DateTimeFormatter patterns. In these patterns, YYYY is the week-based year, so in the last days of December the default can produce next year’s index name. Set yyyy.MM.dd to use the calendar year.