Matchmaker logs
Learn how Matchmaker logs provide insights into matchmaking activity and help diagnose issues.
읽는 시간 8분최근 업데이트: 10일 전
Matchmaker writes a log record for each significant event in the life of a matchmaking ticket, so you can detect and debug live issues. Records are available in the Unity Dashboard, and you can filter them by time range and by content using a query language.
Logging has the following characteristics:
- Structured, OpenTelemetry-compliant log schema
- Seven days of retention
- Time range and log field filters
- Pagination
For an explanation of the ticket states these records describe, refer to Matchmaker ticket flow.
Access logs
To access Matchmaker logs from the Unity Dashboard, follow these steps:
- In the Unity Dashboard, go to Development > Products.
- Select Matchmaker.
- Select Logs.
Understand record types
Matchmaker emits two kinds of records. Both appear in the same log stream and both carry log attributes, but you read their message bodies in different ways.
- Ticket lifecycle records
- Match builder snapshots
Ticket lifecycle records describe a single event, such as the creation of a ticket or a match. The attribute identifies the event, and the message body carries the payload your game sent. For example, a body contains the whole ticket, including its players, custom data, Quality of Service (QoS) results, attributes, and author.
matchmaker.event.nameticket.createdMatch builder snapshots describe an attempt to build a match that didn't succeed. Matchmaker emits a snapshot when a ticket expires without matching, which makes snapshots the primary signal for diagnosing tickets that never match. A snapshot carries a JSON message body rather than prose, and the body contains the applied rules, the teams, the per-ticket player details with their QoS results, the match definition, and a field. Parse the body to read these values.
timeoutReasonSnapshots carry no , because event names describe ticket lifecycle events. Snapshots do carry and , so a filter on either attribute returns the snapshots for a ticket alongside its lifecycle records. A record with a JSON body and no event name is a snapshot.
matchmaker.event.namematchmaker.ticket.idmatchmaker.player.idsLog attributes
Matchmaker adds a set of attributes to each record, which you can both filter on and read back. Every record also carries the and resource attributes, and a unique .
unity.project.idunity.environment.idlog.record.uidThe following table lists the attributes that appear in the field of a log response, and the records each one appears on.
logAttributesAttribute | Description | Appears on |
|---|---|---|
| The lifecycle event this record describes. Refer to Event names. | Ticket lifecycle records |
| The name of the queue the ticket or match belongs to. | Records where the queue is known |
| The name of the pool the ticket or match belongs to. | Records where the pool is known |
| The ID of a single matchmaking ticket. | Ticket-scoped records |
| A comma-separated list of the IDs of the tickets that formed the match. | Match creation records |
| A comma-separated list of the IDs of the players on the ticket or in the snapshot. | Ticket-scoped records and match builder snapshots |
| The ID of the match. | Match-scoped and allocation-scoped records |
| The ID of the backfill ticket. | Backfill records |
Event names
The attribute takes one of the following values.
matchmaker.event.nameEvent name | Occurs when |
|---|---|
| Your game creates a matchmaking ticket. |
| Matchmaker deletes a ticket. |
| A ticket reaches its timeout before Matchmaker matches it. |
| Matchmaker creates the assignment that tells a player where to connect. |
| Matchmaker creates a match from a set of tickets. |
| Matchmaker creates a backfill ticket. |
| Matchmaker updates a backfill ticket. |
| Matchmaker deletes a backfill ticket. |
| Matchmaker adds players to an existing match through backfill. |
| Matchmaker requests a server allocation for a match. |
| A server allocation succeeds. |
| A server allocation fails. |
Filter logs
The logging service supports a custom query language that allows you to filter the structured logs.
This section walks you through the syntax and usage of the query language, and provides some examples to help you get started.
Basic syntax and operators
A filter query consists of one or more conditions. The basic syntax of a condition consists of the following components:
Component | Condition |
|---|---|
| Field | The field you want to filter on, such as |
| Operator | One of the supported operators. Refer to the table of operators below. |
| Value | The value you want to compare the field against. |
Refer to the table below for a list of supported operators.
Operator | Meaning |
|---|---|
| equals |
| not equals |
| contains |
| does not contain |
| greater than |
| less than |
| less than or equal to |
| greater than or equal to |
The contains operators match a substring anywhere in the value, and they ignore case. Use them on any field, including log attributes, which is how you find one player in a comma-separated list.
Boolean expressions and grouping
You can create complex filter queries with Boolean expressions and parentheses. Combine multiple conditions this way to create precise filters.
Boolean expression | Meaning |
|---|---|
| Require both conditions on either side to be true. |
| Require at least one of the conditions on either side to be true. |
| Grouping | Use parentheses |
The query language also interprets line feeds as Boolean operators, which simplifies query writing. Write one condition per line when you want all of them to match:
ANDresourceAttributes.service.name = "matchmaker"severityNumber >= 12
Examples of filter queries
Consult the following example filter queries to search through your logs:
Description | Filter query |
|---|---|
| Search logs for a pool by name | |
| Search logs for a queue by name | |
| Search logs for an environment ID | |
| Search logs for a match ID | |
| Search logs for a ticket ID | |
| Search logs for a match that contains a ticket | |
| Search logs for a backfill ticket ID | |
| Select all records for one lifecycle event | |
| Select all logs with a certain severity level | |
| Exclude logs with a particular word in the message | |
| Combine multiple conditions and groupings (using severity alias) | |
Filter query rules
Be aware of the following filter query language rules:
- The field is also aliased as
severityTextfor convenience.severity - Field names such as and
logAttributesaren't case-sensitive, but the attribute keys that follow them are. WriteseverityTextexactly as it appears in Log attributes.matchmaker.backfillTicket.id - The logging service converts attribute values to strings automatically.
- A query can't contain the ,
[, or]characters.? - You can't filter on the record timestamp. Use the time range parameters instead.
- You can't filter on the project ID. The project the query runs against is fixed by the request.
Diagnose a ticket that never matched
When a player reports that they can't get a match, the ticket timeout record and the match builder snapshot together explain why. Matchmaker emits both when the ticket expires.
To find out why a ticket didn't match, follow these steps:
-
Retrieve every record for the ticket:logAttributes.matchmaker.ticket.id = "<ticketId>"
-
Confirm the ticket expired. The timeout record is the one whoseis
matchmaker.event.name.ticket.timed_out -
Find the match builder snapshot in the same result set. It's the record with a JSON body and no.
matchmaker.event.name -
Parse the snapshot's body and read thefield, then compare the applied rules and the per-ticket QoS results against the pool configuration.
timeoutReason
Find the records for one player
The attribute holds a comma-separated list, because a ticket can carry a party of several players. An equality filter only matches a ticket whose entire list is that one player, so use the contains operator to match a single player:
matchmaker.player.idslogAttributes.matchmaker.player.ids ~= "<playerId>"
This query returns both the ticket lifecycle records and the match builder snapshots for that player, which gives you the ticket's history and the explanation of why it never matched in one result set.