Skip to content

mc watch

Syntax

The mc watch command watches for events on the specified MinIO bucket or local filesystem path. For S3 services, use mc event add to configure bucket event notifications on S3-compatible services.

You can also use mc watch against a local filesystem directory to produce similar results to running the inotify -e modify,create,delete,move command.

The following command watches for events on any object or prefix in the mydata bucket on the myminio MinIO deployment:

mc watch --recursive myminio/mydata

The command has the following syntax:

mc [GLOBALFLAGS] watch                \
                 [--events "string"]   \
                 [--prefix "string"]  \
                 [--recursive]        \
                 [--suffix "string"]  \
                 ALIAS
  • Brackets [] indicate optional parameters.
  • Parameters sharing a line are mutually dependent.
  • 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

mc-cmd

Required The alias of a MinIO deployment and the full path to the bucket to watch for configured events. For example:

mc watch myminio/mybucket
--events

mc-cmd

The event(s) to watch for. Specify multiple events using a comma , delimiter. See Supported Bucket Events for supported events.

Defaults to put,delete, get.

--prefix

mc-cmd

The bucket prefix in which to watch for the specified --events.

For example, given a ALIAS of play/mybucket and a --prefix of photos, only events in play/mybucket/photos trigger bucket notifications.

--recursive, r

mc-cmd

Recursively watch for events in the specified ALIAS bucket path or local directory.

--suffix

mc-cmd

The bucket suffix in which to watch for the specified --events.

For example, given a ALIAS of play/mybucket and a --suffix of .jpg, only events in play/mybucket/*.jpg trigger bucket notifications.

Global Flags

--json

mc-cmd

Optional

Enables JSON lines formatted output to the console.

For example:

mc --json COMMAND

Examples

Watch for Events in a Bucket

mc watch --recursive ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.
  • Replace PATH with the path to the bucket.

Behavior

S3 Compatibility

SILO is the supported server for PGSTY mcli; compatibility with upstream MinIO and other S3 services is best effort.