---
name: "mongoc_structured_log_opts_set_max_document_length"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_structured_log_opts_set_max_document_length"
---

# mongoc\_structured\_log\_opts\_set\_max\_document\_length(3)

## SYNOPSIS

```
bool
mongoc_structured_log_opts_set_max_document_length (mongoc_structured_log_opts_t *opts,
                                                    size_t max_document_length);
```

Sets a maximum length for BSON documents that appear serialized in JSON form as part of a structured log message.

Serialized JSON will be truncated at this limit, interpreted as a count of UTF-8 encoded bytes. Truncation will be indicated with a **...** suffix, the length of which is not included in the max document length. If truncation at the exact indicated length would split a valid UTF-8 sequence, we instead truncate the document earlier at the nearest boundary between code points.

## PARAMETERS

- •

  **opts**: Structured log options, allocated with *mongoc\_structured\_log\_opts\_new()*.

- •

  **max\_document\_length**: Maximum length for each embedded JSON document, in bytes, not including an ellipsis (**...**) added to indicate truncation. Values near or above **INT\_MAX** will be rejected.

## RETURNS

Returns **true** on success, or **false** if the supplied maximum length is too large.

**SEE ALSO:**

```
Structured Logging
mongoc_structured_log_opts_set_max_document_length_from_env()
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
