describeFieldIndexes method
Returns a list of field indexes discovered in log data. By default, the
response includes the DEFAULT, CUSTOM, and
INACTIVE index categories. To return indexes from other
categories, use the indexCategories parameter.
For more information about field index policies, see PutIndexPolicy.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw OperationAbortedException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
Parameter logGroupIdentifiers :
An array containing the names or ARNs of the log groups that you want to
retrieve field indexes for.
Parameter indexCategories :
The index categories to return. The following values are supported:
-
DEFAULT: Fields that CloudWatch Logs indexes by default. Examples include@logStreamand@data_format. -
CUSTOM: Fields that you added manually to the field index policy. CloudWatch Logs always indexes these fields. These fields count toward the quota of 20 fields for each log group. -
AUTO: Fields that CloudWatch Logs indexes automatically based on your query patterns and usage. These fields do not count toward the field index quota. CloudWatch Logs might update these fields based on changes in your query patterns. To keep a field indexed permanently, add it to an account-level or log-group level field index policy. -
INACTIVE: Fields that CloudWatch Logs indexed before but does not index now. This happens if you remove a field from the field index policy or if CloudWatch Logs automatically selects a different field based on your queries.
DEFAULT, CUSTOM, and INACTIVE
categories.
For more information about automatically indexed fields and using the
AUTO category, see Automatically
indexed fields.
Implementation
Future<DescribeFieldIndexesResponse> describeFieldIndexes({
required List<String> logGroupIdentifiers,
List<IndexCategory>? indexCategories,
String? nextToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Logs_20140328.DescribeFieldIndexes'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'logGroupIdentifiers': logGroupIdentifiers,
if (indexCategories != null)
'indexCategories': indexCategories.map((e) => e.value).toList(),
if (nextToken != null) 'nextToken': nextToken,
},
);
return DescribeFieldIndexesResponse.fromJson(jsonResponse.body);
}