:doc:`CloudWatchLogs <../../logs>` / Client / describe_metric_filters

***********************
describe_metric_filters
***********************



.. py:method:: CloudWatchLogs.Client.describe_metric_filters(**kwargs)

  

  Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFilters>`_  


  **Request Syntax**
  ::

    response = client.describe_metric_filters(
        logGroupName='string',
        filterNamePrefix='string',
        nextToken='string',
        limit=123,
        metricName='string',
        metricNamespace='string'
    )
    
  :type logGroupName: string
  :param logGroupName: 

    The name of the log group.

    

  
  :type filterNamePrefix: string
  :param filterNamePrefix: 

    The prefix to match. CloudWatch Logs uses the value that you set here only if you also include the ``logGroupName`` parameter in your request.

    

  
  :type nextToken: string
  :param nextToken: 

    The token for the next set of items to return. (You received this token from a previous call.)

    

  
  :type limit: integer
  :param limit: 

    The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

    

  
  :type metricName: string
  :param metricName: 

    Filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the ``metricNamespace`` parameter.

    

  
  :type metricNamespace: string
  :param metricNamespace: 

    Filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the ``metricName`` parameter.

    

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

    
    ::

      {
          'metricFilters': [
              {
                  'filterName': 'string',
                  'filterPattern': 'string',
                  'metricTransformations': [
                      {
                          'metricName': 'string',
                          'metricNamespace': 'string',
                          'metricValue': 'string',
                          'defaultValue': 123.0,
                          'dimensions': {
                              'string': 'string'
                          },
                          'unit': 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None'
                      },
                  ],
                  'creationTime': 123,
                  'logGroupName': 'string',
                  'applyOnTransformedLogs': True|False,
                  'fieldSelectionCriteria': 'string',
                  'emitSystemFieldDimensions': [
                      'string',
                  ]
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **metricFilters** *(list) --* 

        The metric filters.

        
        

        - *(dict) --* 

          Metric filters express how CloudWatch Logs would extract metric observations from ingested log events and transform them into metric data in a CloudWatch metric.

          
          

          - **filterName** *(string) --* 

            The name of the metric filter.

            
          

          - **filterPattern** *(string) --* 

            A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

            
          

          - **metricTransformations** *(list) --* 

            The metric transformations.

            
            

            - *(dict) --* 

              Indicates how to transform ingested log events to metric data in a CloudWatch metric.

              
              

              - **metricName** *(string) --* 

                The name of the CloudWatch metric.

                
              

              - **metricNamespace** *(string) --* 

                A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see `Namespaces <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace>`__.

                
              

              - **metricValue** *(string) --* 

                The value to publish to the CloudWatch metric when a filter pattern matches a log event.

                
              

              - **defaultValue** *(float) --* 

                (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.

                
              

              - **dimensions** *(dict) --* 

                The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

                 

                .. warning::

                   

                  Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as ``IPAddress`` or ``requestID`` as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

                   

                  CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges.

                   

                  You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see `Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html>`__.

                  

                
                

                - *(string) --* 
                  

                  - *(string) --* 
            
          
              

              - **unit** *(string) --* 

                The unit to assign to the metric. If you omit this, the unit is set as ``None``.

                
          
        
          

          - **creationTime** *(integer) --* 

            The creation time of the metric filter, expressed as the number of milliseconds after ``Jan 1, 1970 00:00:00 UTC``.

            
          

          - **logGroupName** *(string) --* 

            The name of the log group.

            
          

          - **applyOnTransformedLogs** *(boolean) --* 

            This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see `PutTransformer <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutTransformer.html>`__.

             

            If this value is ``true``, the metric filter is applied on the transformed version of the log events instead of the original ingested log events.

            
          

          - **fieldSelectionCriteria** *(string) --* 

            The filter expression that specifies which log events are processed by this metric filter based on system fields. Returns the ``fieldSelectionCriteria`` value if it was specified when the metric filter was created.

            
          

          - **emitSystemFieldDimensions** *(list) --* 

            The list of system fields that are emitted as additional dimensions in the generated metrics. Returns the ``emitSystemFieldDimensions`` value if it was specified when the metric filter was created.

            
            

            - *(string) --* 
        
      
    
      

      - **nextToken** *(string) --* 

        The token for the next set of items to return. The token expires after 24 hours.

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

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

  
  *   :py:class:`CloudWatchLogs.Client.exceptions.ServiceUnavailableException`

  