:doc:`CognitoIdentityProvider <../../cognito-idp>` / Client / set_log_delivery_configuration

******************************
set_log_delivery_configuration
******************************



.. py:method:: CognitoIdentityProvider.Client.set_log_delivery_configuration(**kwargs)

  

  Sets up or modifies the logging configuration of a user pool. User pools can export user notification logs and, when threat protection is active, user-activity logs. For more information, see `Exporting user pool logs <https://docs.aws.amazon.com/cognito/latest/developerguide/exporting-quotas-and-usage.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cognito-idp-2016-04-18/SetLogDeliveryConfiguration>`_  


  **Request Syntax**
  ::

    response = client.set_log_delivery_configuration(
        UserPoolId='string',
        LogConfigurations=[
            {
                'LogLevel': 'ERROR'|'INFO',
                'EventSource': 'userNotification'|'userAuthEvents',
                'CloudWatchLogsConfiguration': {
                    'LogGroupArn': 'string'
                },
                'S3Configuration': {
                    'BucketArn': 'string'
                },
                'FirehoseConfiguration': {
                    'StreamArn': 'string'
                }
            },
        ]
    )
    
  :type UserPoolId: string
  :param UserPoolId: **[REQUIRED]** 

    The ID of the user pool where you want to configure logging.

    

  
  :type LogConfigurations: list
  :param LogConfigurations: **[REQUIRED]** 

    A collection of the logging configurations for a user pool.

    

  
    - *(dict) --* 

      The configuration of user event logs to an external Amazon Web Services service like Amazon Data Firehose, Amazon S3, or Amazon CloudWatch Logs.

      

    
      - **LogLevel** *(string) --* **[REQUIRED]** 

        The ``errorlevel`` selection of logs that a user pool sends for detailed activity logging. To send ``userNotification`` activity with `information about message delivery <https://docs.aws.amazon.com/cognito/latest/developerguide/exporting-quotas-and-usage.html>`__, choose ``ERROR`` with ``CloudWatchLogsConfiguration``. To send ``userAuthEvents`` activity with user logs from threat protection with the Plus feature plan, choose ``INFO`` with one of ``CloudWatchLogsConfiguration``, ``FirehoseConfiguration``, or ``S3Configuration``.

        

      
      - **EventSource** *(string) --* **[REQUIRED]** 

        The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to ``userNotification``. To send info-level logs about threat-protection user activity in user pools with the Plus feature plan, set to ``userAuthEvents``.

        

      
      - **CloudWatchLogsConfiguration** *(dict) --* 

        The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with threat protection.

        

      
        - **LogGroupArn** *(string) --* 

          The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

           

          To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with ``/aws/vendedlogs``. For more information, see `Enabling logging from certain Amazon Web Services services <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html>`__.

          

        
      
      - **S3Configuration** *(dict) --* 

        The Amazon S3 bucket destination of user activity log export with threat protection. To activate this setting, your user pool must be on the `Plus tier <https://docs.aws.amazon.com/cognito/latest/developerguide/feature-plans-features-plus.html>`__.

        

      
        - **BucketArn** *(string) --* 

          The ARN of an Amazon S3 bucket that's the destination for threat protection log export.

          

        
      
      - **FirehoseConfiguration** *(dict) --* 

        The Amazon Data Firehose stream destination of user activity log export with threat protection. To activate this setting, your user pool must be on the `Plus tier <https://docs.aws.amazon.com/cognito/latest/developerguide/feature-plans-features-plus.html>`__.

        

      
        - **StreamArn** *(string) --* 

          The ARN of an Amazon Data Firehose stream that's the destination for threat protection log export.

          

        
      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'LogDeliveryConfiguration': {
              'UserPoolId': 'string',
              'LogConfigurations': [
                  {
                      'LogLevel': 'ERROR'|'INFO',
                      'EventSource': 'userNotification'|'userAuthEvents',
                      'CloudWatchLogsConfiguration': {
                          'LogGroupArn': 'string'
                      },
                      'S3Configuration': {
                          'BucketArn': 'string'
                      },
                      'FirehoseConfiguration': {
                          'StreamArn': 'string'
                      }
                  },
              ]
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **LogDeliveryConfiguration** *(dict) --* 

        The logging configuration that you applied to the requested user pool.

        
        

        - **UserPoolId** *(string) --* 

          The ID of the user pool where you configured logging.

          
        

        - **LogConfigurations** *(list) --* 

          A logging destination of a user pool. User pools can have multiple logging destinations for message-delivery and user-activity logs.

          
          

          - *(dict) --* 

            The configuration of user event logs to an external Amazon Web Services service like Amazon Data Firehose, Amazon S3, or Amazon CloudWatch Logs.

            
            

            - **LogLevel** *(string) --* 

              The ``errorlevel`` selection of logs that a user pool sends for detailed activity logging. To send ``userNotification`` activity with `information about message delivery <https://docs.aws.amazon.com/cognito/latest/developerguide/exporting-quotas-and-usage.html>`__, choose ``ERROR`` with ``CloudWatchLogsConfiguration``. To send ``userAuthEvents`` activity with user logs from threat protection with the Plus feature plan, choose ``INFO`` with one of ``CloudWatchLogsConfiguration``, ``FirehoseConfiguration``, or ``S3Configuration``.

              
            

            - **EventSource** *(string) --* 

              The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to ``userNotification``. To send info-level logs about threat-protection user activity in user pools with the Plus feature plan, set to ``userAuthEvents``.

              
            

            - **CloudWatchLogsConfiguration** *(dict) --* 

              The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with threat protection.

              
              

              - **LogGroupArn** *(string) --* 

                The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

                 

                To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with ``/aws/vendedlogs``. For more information, see `Enabling logging from certain Amazon Web Services services <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html>`__.

                
          
            

            - **S3Configuration** *(dict) --* 

              The Amazon S3 bucket destination of user activity log export with threat protection. To activate this setting, your user pool must be on the `Plus tier <https://docs.aws.amazon.com/cognito/latest/developerguide/feature-plans-features-plus.html>`__.

              
              

              - **BucketArn** *(string) --* 

                The ARN of an Amazon S3 bucket that's the destination for threat protection log export.

                
          
            

            - **FirehoseConfiguration** *(dict) --* 

              The Amazon Data Firehose stream destination of user activity log export with threat protection. To activate this setting, your user pool must be on the `Plus tier <https://docs.aws.amazon.com/cognito/latest/developerguide/feature-plans-features-plus.html>`__.

              
              

              - **StreamArn** *(string) --* 

                The ARN of an Amazon Data Firehose stream that's the destination for threat protection log export.

                
          
        
      
    
  
  **Exceptions**
  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.InternalErrorException`

  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.TooManyRequestsException`

  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.NotAuthorizedException`

  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`CognitoIdentityProvider.Client.exceptions.FeatureUnavailableInTierException`

  