> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> The system logs all noteworthy actions and changes pertaining to tickets. Learn how to write messages to the log and to search the log from CRMScript.

<Note>
  This feature requires a **Service Premium** license or the **Growth** plan.
</Note>

The system logs all noteworthy actions and changes pertaining to tickets. You can also add your own log entries.

## Write a message to the ticket log

You can manually write messages to the ticket log. Not to be confused with the message objects associated with the ticket.

### Void log(String message)

Logs a message to the ticket log.

```crmscript theme={null}
Ticket t;
t.load(2);
t.log("here we go again!");
```

### Void log(String who, String message)

A variant of `log()` that includes who made the entry.

```crmscript theme={null}
Ticket t;
t.load(2);
t.log("SuperStar RequestHandler", "I can handle anything and anyone!");
```

## Search the log

When inspecting logs, the CRMScript [SearchEngine][1] is your best friend. Here's some info commonly filtered on:

* ticket\_id
* message\_id
* user\_id
* customer\_id
* log\_when (DateTime)

Look up more options in the [database reference][2].

**Example searches:**

* requests amended or updated in a specific way within a specific period
* all requests that a user has changed in the last week, regardless of who is responsible for the request or what status it has

```crmscript! theme={null}
DateTime dt;
dt.moveToWeekStart();

SearchEngine se;
se.addField("ticket.id");
se.addField("ticket.title");
se.addCriteria("ticket.status", "OperatorEquals", "4", "OperatorAnd", 0);
se.addCriteria("ticket.last_changed", "OperatorGt", dt.toString(), "OperatorAnd", 0);

print(se.executeTextTable());
```

This will print the ID and title of any merged tickets updated sometime during the current week.

## Database entries

For each change to a ticket, new entries are added to both the **ticket\_log\_action** table and the **ticket\_log\_change** table.

| Table               | Entries                                 | Enum           |
| :------------------ | :-------------------------------------- | :------------- |
| ticket\_log\_action | 1 entry with the timestamp              | [LogAction][3] |
| ticket\_log\_change | 1 entry for each value that has changed | [LogChange][4] |

[1]: ../../searchengine/index

[2]: ../../../../database/tables/ticket-log

[3]: ../../../../database/tables/ticket-log-action

[4]: ../../../../database/tables/ticket-log-change


## Related topics

- [Log in](/en/learn/getting-started/login.md)
- [Log Messages](/en/automation/crmscript/debugging/log-messages.md)
- [Filtering the logs](/en/onsite/logging/filter-logs.md)
- [Change Log Settings](/en/api/reference/restful/agent/diagnostics_agent/change-log-settings.md)
- [log_events table](/en/database/tables/log-events.md)
- [log_debug table](/en/database/tables/log-debug.md)
