Navigation

mongocli atlas events list

On this page

The events list command retrieves information about events for a given Atlas project or organization. You must specify either a project or an organization in the command.

Syntax

mongocli atlas events list|ls
     [ --profile|-P <profile-name> ]
     [ --projectId <project-ID> ]
     [ --orgId <organization-ID> ]
     [ --limit <items-per-page> ]
     [ --maxDate <max-date> ]
     [ --minDate <min-date> ]
     [ --page <page-num> ]

Note

Use -h or --help to view the command-line help for this command.

Options

Specify either a project with --projectId or an organization with --orgId.

Option Type Description Required?
--profile, -P string Name of the profile where the project ID and the Programmatic API Keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string Unique identifier of the project for which to retrieve events. yes
--orgId string Unique identifier of the organization for which to retrieve events. yes
--limit integer Number of items per page. no
--maxDate string Return events whose created date is less than or equal to it. no
--minDate string Return events whose created date is greater than or equal to it. no
--page integer Page number. no

Note

The --orgId and --projectId flags are exclusive. You must use one or the other, but not both.

Output

The command prints the following fields in JSON format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

events list returns an array of documents, each representing one event within your Atlas project or organization.

Note

A subset of the following fields may appear, depending on the event type.

Name Type Description
alertId string Unique identifier for the alert associated with the event.
alertConfigId string Unique identifier for the alert configuration associated with the alertId.
apiKeyId string Unique identifier for the API Key that triggered the event. If this field is present in the response, the command does not return the userId field.
collection string Name of the collection on which the event occurred. This field can be present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
created date ISO 8601-formatted UTC date when the event occurred.
currentValue document Describes the value of the metricName at the time of the event.
currentValue.number int The value of the metricName at the time of the event.
currentValue.units string

The unit of measurement of the currentValue.number.

Possible values are:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
database string Name of the database on which the event occurred. This field can be present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
eventTypeName string

The type of event.

Possible values are:

Alert type Possible values
Host
OUTSIDE_METRIC_THRESHOLD
HOST_RESTARTED
HOST_UPGRADED
HOST_NOW_SECONDARY
HOST_NOW_PRIMARY
Replica set
NO_PRIMARY
TOO_MANY_ELECTIONS
Sharded cluster CLUSTER_MONGOS_IS_MISSING
User
JOINED_GROUP
REMOVED_FROM_GROUP
USER_ROLES_CHANGED_AUDIT
Project
USERS_AWAITING_APPROVAL
USERS_WITHOUT_MULTI_FACTOR_AUTH
GROUP_CREATED
Team
JOINED_TEAM
REMOVED_FROM_TEAM
Organization
INVITED_TO_ORG
JOINED_ORG
Data Explorer
DATA_EXPLORER
DATA_EXPLORER_CRUD
Billing
CREDIT_CARD_ABOUT_TO_EXPIRE
CHARGE_SUCCEEDED
INVOICE_CLOSED
groupId string The unique identifier for the project in which the event occurred.
hostname string The hostname of the host machine associated with the event.
id string The unique identifier for the event.
invoiceId string The unique identifier of the invoice associated with the event.
isGlobalAdmin boolean Flag indicating whether the user who triggered this event has the Global Monitoring Administrator role.
links array One or more links to sub-resources and/or related resources.
metricName string The name of the metric associated with the alertId.
opType string Type of operation that occurred. This field is present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
orgId string The unique identifier for the organization in which the event occurred.
paymentId string The unique identifier of the invoice payment associated with the event.
port int The port on which the mongod or mongos listens.
publicKey string Public key associated with the API Key that triggered the event. If this field is present in the response, the command does not return the username field.
remoteAddress string IP address of the userId user who triggered the event.
replicaSetName string The name of the replica set associated with the event.
shardName string The name of the shard associated with the event.
targetPublicKey string The public key of the API Key targeted by the event.
targetUsername string The username for the user targeted by the event.
teamId string The unique identifier for the team associated with the event.
userId string The unique identifier for the user who triggered the event. If this field is present in the response, does not return the apiKeyId field.
username string The username for the user who triggered the event. If this field is present in the response, the command does not return the publicKey field.
whitelistEntry string The whitelist entry of the API Key targeted by the event.
totalCount number The number of events returned.

Example

The following example uses the mongocli atlas events list command to retrieve information about events on the project with project ID 5dd5a6b6f10fab1d71a58495. It uses credentials stored a profile named egAtlasProfile.

mongocli atlas events list --projectId 5dd5a6b6f10fab1d71a58495 \
  --profile egAtlasProfile

The previous example produces the following output:

{
   "links": [
             {
                     "rel": "self",
                     "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5dd5a6b6f10fab1d71a58495/events?pageNum=1\u0026itemsPerPage=100"
             },
             {
                     "rel": "next",
                     "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5dd5a6b6f10fab1d71a58495/events?itemsPerPage=100\u0026pageNum=2"
             }
       ],
       "results": [
             {
                     "alertId": "",
                     "alertConfigId": "",
                     "created": "2020-04-28T21:35:53Z",
                     "eventTypeName": "",
                     "groupId": "5dd5a6b6f10fab1d71a58495",
                     "hostname": "",
                     "id": "5ea8a1b99686076aaeddda0e",
                     "links": [
                             {
                                     "rel": "self",
                                     "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5dd5a6b6f10fab1d71a58495/events/5ea8a1b99686076aaeddda0e"
                             }
                     ]
             },
             {
                     "alertId": "",
                     "alertConfigId": "",
                     "collection": "listingsAndReviews",
                     "created": "2020-04-28T21:35:08Z",
                     "database": "sample_airbnb",
                     "eventTypeName": "DATA_EXPLORER",
                     "groupId": "5dd5a6b6f10fab1d71a58495",
                     "hostname": "",
                     "id": "5ea8a18c60e808539ca00023",
                     "links": [
                             {
                                     "rel": "self",
                                     "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5dd5a6b6f10fab1d71a58495/events/5ea8a18c60e808539ca00023"
                             }
                     ],
                     "opType": "find",
                     "remoteAddress": "71.202.1.242",
                     "userId": "5dd5a63b7a3e5a6c5bd0c8a3",
                     "username": "user@example.com"
             },
        ...
   ],
 "totalCount": 258
}