mc log api

The mc log api command views and manages the recorded API logs on a MinIO AIStor deployment.

The following command shows the API logs recorded in the last 24 hours on the myaistor MinIO AIStor cluster:

mc log api --last 24h myaistor

The command has the following syntax:

mc [GLOBALFLAGS] log api                       \
                 [--last DURATION]             \
                 [--nodes NODE]                \
                 [--buckets BUCKET]            \
                 [--prefix PREFIX]             \
                 [--apis API]                  \
                 [--status-codes CODE]         \
                 [--origins ORIGIN]            \
                 [--api-types TYPE]            \
                 [--limit NUMBER]              \
                 [--out FILE | --in FILE]      \
                 [--get-config | --set-config FILE] \
                 [ALIAS]
  • Brackets [] indicate optional parameters.
  • Parameters separated using the pipe | operator are mutually exclusive.

Copy the example to a text editor and modify as-needed before running the command in the terminal/shell.

Parameters

ALIAS

Required

The alias of a MinIO AIStor cluster.

ALIAS is optional when you use --in to view a saved file.

--last

Alias: -l

Optional

Show logs for the last duration, for example 5m, 2h, or 1d.

--nodes

Alias: -n

Optional

Filter logs by node name. Specify multiple times to match multiple nodes. An entry ending with * is a prefix match.

--buckets

Optional

Filter logs by bucket name. Specify multiple times to match multiple buckets. An entry ending with * is a prefix match.

--prefix

Optional

Filter logs by object prefix.

--apis

Optional

Filter logs by API name, for example putobject or getobject. Specify multiple times to match multiple APIs. An entry ending with * is a prefix match.

--status-codes

Optional

Filter logs by HTTP status code. Specify multiple times to match multiple codes, for example --status-codes 200 --status-codes 404.

--origins

Optional

Filter logs by request origin. Specify one or more of: client, site-repl, ilm, batch, rebal, repl, decom, heal.

--api-types

Optional

Filter logs by API category. Specify one or more of: object, bucket, admin, auth, table.

--limit

Optional

Limit the total number of log entries returned. Defaults to 1000.

--out

Alias: -o

Optional

Save the logs to a compressed (.zst) file instead of printing them. View the saved file later with --in.

--in

Optional

View logs from a previously saved file instead of querying the deployment. Filter flags apply to the saved file when replaying.

--get-config

Optional

Export the current API log recorder configuration to YAML on standard output. Redirect to a file to edit it, for example mc log api --get-config ALIAS > api-config.yaml.

The API recorder configuration includes the enable, retention, maintenanceInterval, and orphanGracePeriod keys.

--set-config

Optional

Apply an API log recorder configuration from a YAML file to the deployment.

Global flags

This command supports any of the global flags.

Examples

Show recent API logs

mc log api --last 24h myaistor

Filter by bucket and API

mc log api --buckets photos --apis putobject myaistor

Export and re-apply the recorder configuration

mc log api --get-config myaistor > api-config.yaml
mc log api --set-config api-config.yaml myaistor

Save logs for offline review

mc log api --out api-logs.zst myaistor
mc log api --in api-logs.zst

On this page