11.. _arch-center-auditing-logging:
22
33====================
4- Auditing and Logging
4+ Auditing and Logging
55====================
66
77.. default-domain:: mongodb
@@ -12,40 +12,117 @@ Auditing and Logging
1212 :depth: 1
1313 :class: onecol
1414
15- Intro statement
15+ To monitor and log |service| platform activities, use auditing and logs.
1616
1717{+service+} Features and Best Practices for Auditing and Logging
1818----------------------------------------------------------------
1919
20- Content here
20+ .. _auditing:
2121
22- Examples
23- --------
22+ Auditing
23+ ~~~~~~~~
2424
25- The following examples <perform this action> using |service|
26- :ref:`tools for automation <arch-center-automation>`.
25+ Database auditing lets you track system activity for deployments with
26+ multiple users. As a |service| administrator, you can:
2727
28- .. tabs::
28+ - Rely on default auditing settings in |service|. By default, |service|
29+ performs database authentication auditing in ``M10+`` {+clusters+} to
30+ record authentication events, including those pertaining to:
31+
32+ - database users
33+ - source IP addresses
34+ - timestamps for successful and failed attempts
35+
36+ - Configure a JSON-formatted audit filter to customize MongoDB auditing
37+ and select the actions, database users, |service| roles, and |ldap| groups
38+ that you want to audit. If you create a custom audit filter, you can
39+ skip using the managed {+atlas-ui+} auditing filter builder and configure
40+ your own tailored filter of event auditing.
41+
42+ You can :manual:`configure manual auditing </core/auditing>` of most of the
43+ documented :manual:`system event actions </reference/audit-message/mongo/>`
44+ in |service|. Granular MongoDB database auditing allows you to track
45+ usage of all DDL (Data Definition Language), DML (Data Manipulation Language),
46+ and DCL (Data Control Language) commands in detail. For a full list of
47+ events you can configure for auditing, and for a list of examples,
48+ see :manual:`MongoDB auditing </core/auditing>`. See also
49+ :atlas:`Set up Database Auditing </database-auditing>`.
50+
51+ - :atlas:`Audit the actions of temporary database users </production-notes/#audit-temporary-database-users>`.
52+
53+ .. _accessing-audit-logs:
54+
55+ Accessing Audit Logs
56+ ~~~~~~~~~~~~~~~~~~~~~
57+
58+ .. include:: /includes/cloud-docs/logs.rst
59+
60+ To retrieve the audit logs using the {+atlas-admin-api+}, see
61+ :oas-atlas-op:`Logs </downloadLogsForOneClusterHostInOneProject>`. You
62+ can use these API commands:
63+
64+ - :ref:`atlas-auditing-describe <atlas-auditing-describe>` returns the
65+ auditing configuration for the specified project.
66+ - :ref:`atlas-auditing-update <atlas-auditing-update>` updates
67+ the auditing configuration for the specified project.
2968
30- .. tab:: Dev and Test Environments
31- :tabid: devtest
69+ You can :ref:`view authentication attempts <access-tracking>` that users
70+ make against your {+cluster+}. |service| logs both successful and unsuccessful
71+ authentication attempts, including the timestamp of each attempt and which
72+ user tried to authenticate.
3273
33- .. include:: /includes/shared-settings-clusters-devtest.rst
74+ You can :ref:`view and filter the activity feed <view-activity-feed>`
75+ for an organization or project.
3476
35- .. tab:: Staging and Prod Environments
36- :tabid: stagingprod
77+ To perform a full audit, you can use a combination of audit logs,
78+ the ``mongodb.log``, and :ref:`the project activity feed <view-activity-feed>`.
3779
38- .. include:: /includes/shared-settings-clusters-stagingprod.rst
80+ You can use the ``atlas deployments logs`` command in the {+atlas-cli+}
81+ to retrieve deployment logs. To learn more,
82+ see :atlas:`Atlas Deployment Logs </cli/current/command/atlas-deployments-logs/>`.
83+
84+ Examples
85+ --------
86+
87+ The following examples show how to download logs and enable auditing
88+ using |service| :ref:`tools for automation <arch-center-automation>`.
89+
90+ In addition to the following examples, see the blogpost
91+ `Streamlining Log Management to Amazon S3 Using Atlas Push-based Log Exports With HashiCorp Terraform <https://www.mongodb.com/developer/products/atlas/streamlining-log-management-amazon-s3-atlas-push-based-log-exports-hashicorp-terraform/>`__.
3992
4093.. tabs::
4194
4295 .. tab:: CLI
4396 :tabid: cli
4497
45- Content here
98+ Download Logs
99+ ~~~~~~~~~~~~~
100+
101+ Run the following CLI command to download a compressed file that contains the
102+ MongoDB logs for the specified host in your project.
103+
104+ .. include:: /includes/examples/cli-example-download-logs.rst
46105
47106 .. tab:: Terraform
48107 :tabid: Terraform
108+
109+ The following example demonstrates how to enable auditing for
110+ your deployment. Before you can create resources with Terraform,
111+ you must:
112+
113+ - :ref:`Create your paying organization <configure-paying-org>`
114+ and :ref:`create an API key <atlas-admin-api-access>` for the
115+ paying organization. Store your public and private keys as
116+ environment variables by running the following commands in the terminal:
117+
118+ .. code-block::
119+
120+ export MONGODB_ATLAS_PUBLIC_KEY="<insert your public key here>"
121+ export MONGODB_ATLAS_PRIVATE_KEY="<insert your private key here>"
122+
123+ - `Install Terraform <https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli>`__.
49124
50- Content here
125+ Enable Auditing and Create an Auditing Filter for the {+Cluster+}
126+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51127
128+ .. include:: /includes/examples/tf-example-auditing-filter.rst
0 commit comments