mc log api

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

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