put_insight_selectors
¶
put_insight_selectors(
insight_selectors: InsightSelectors,
*,
config_overrides: Optional[CloudTrailClientConfig] = None,
trail_name: Optional[String] = None,
event_data_store: Optional[EventDataStoreArn] = None,
insights_destination: Optional[EventDataStoreArn] = None,
) -> PutInsightSelectorsResponse
Lets you enable Insights event logging on specific event categories by specifying the Insights selectors that you want to enable on an existing trail or event data store. You also use PutInsightSelectors to turn off Insights event logging, by passing an empty list of Insights types. The valid Insights event types are ApiErrorRateInsight and ApiCallRateInsight, and valid EventCategories are Management and Data.
Insights on data events are not supported on event data stores. For event data stores, you can only enable Insights on management events.
To enable Insights on an event data store, you must specify the ARNs (or ID suffix of the ARNs) for the source event data store (EventDataStore) and the destination event data store (InsightsDestination). The source event data store logs management events and enables Insights. The destination event data store logs Insights events based upon the management event activity of the source event data store. The source and destination event data stores must belong to the same Amazon Web Services account.
To log Insights events for a trail, you must specify the name (TrailName) of the CloudTrail trail for which you want to change or add Insights selectors.
-
For Management events Insights: To log CloudTrail Insights on the API call rate, the trail or event data store must log
writemanagement events. To log CloudTrail Insights on the API error rate, the trail or event data store must logreadorwritemanagement events. -
For Data events Insights: To log CloudTrail Insights on the API call rate or API error rate, the trail must log
readorwritedata events. Data events Insights are not supported on event data store.
To log CloudTrail Insights events on API call volume, the trail or event data store must log write management events. To log CloudTrail Insights events on API error rate, the trail or event data store must log read or write management events. You can call GetEventSelectors on a trail to check whether the trail logs management events. You can call GetEventDataStore on an event data store to check whether the event data store logs management events.
For more information, see Working with CloudTrail Insights in the CloudTrail User Guide.
Parameters:
-
trail_name(Optional[String], default:None) –The name of the CloudTrail trail for which you want to change or add Insights selectors.
You cannot use this parameter with the
EventDataStoreandInsightsDestinationparameters. -
insight_selectors(InsightSelectors) –Contains the Insights types you want to log on a specific category of events on a trail or event data store.
ApiCallRateInsightandApiErrorRateInsightare valid Insight types.The EventCategory field can specifyManagementorDataevents or both. For event data store, you can log Insights for management events only.The
ApiCallRateInsightInsights type analyzes write-only management API calls or read and write data API calls that are aggregated per minute against a baseline API call volume.The
ApiErrorRateInsightInsights type analyzes management and data API calls that result in error codes. The error is shown if the API call is unsuccessful. -
event_data_store(Optional[EventDataStoreArn], default:None) –The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the
EventDataStoreandInsightsDestinationparameters.You cannot use this parameter with the
TrailNameparameter. -
insights_destination(Optional[EventDataStoreArn], default:None) –The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the
EventDataStoreandInsightsDestinationparameters.You cannot use this parameter with the
TrailNameparameter.
Raises:
-
CloudTrailARNInvalidException–This exception is thrown when an operation is called with an ARN that is not valid.
The following is the format of a trail ARN:
arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrailThe following is the format of an event data store ARN:
arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLEThe following is the format of a dashboard ARN:
arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDashThe following is the format of a channel ARN:
arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890 -
ConflictException–This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.
-
InsufficientEncryptionPolicyException–For the
CreateTrailPutInsightSelectors,UpdateTrail,StartQuery, andStartImportoperations, this exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.For all other operations, this exception is thrown when the policy for the KMS key does not have sufficient permissions for the operation.
-
InsufficientS3BucketPolicyException–This exception is thrown when the policy on the S3 bucket is not sufficient.
-
InvalidHomeRegionException–This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.
-
InvalidInsightSelectorsException–For
PutInsightSelectors, this exception is thrown when the formatting or syntax of theInsightSelectorsJSON statement is not valid, or the specifiedInsightTypein theInsightSelectorsstatement is not valid. Valid values forInsightTypeareApiCallRateInsightandApiErrorRateInsight. To enable Insights on an event data store, the destination event data store specified by theInsightsDestinationparameter must log Insights events and the source event data store specified by theEventDataStoreparameter must log management events.For
UpdateEventDataStore, this exception is thrown if Insights are enabled on the event data store and the updated advanced event selectors are not compatible with the configuredInsightSelectors. If theInsightSelectorsincludes anInsightTypeofApiCallRateInsight, the source event data store must logwritemanagement events. If theInsightSelectorsincludes anInsightTypeofApiErrorRateInsight, the source event data store must log management events. -
InvalidParameterCombinationException–This exception is thrown when the combination of parameters provided is not valid.
-
InvalidParameterException–The request includes a parameter that is not valid.
-
InvalidTrailNameException–This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:
-
Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)
-
Start with a letter or number, and end with a letter or number
-
Be between 3 and 128 characters
-
Have no adjacent periods, underscores or dashes. Names like
my-_namespaceandmy--namespaceare not valid. -
Not be in IP address format (for example, 192.168.5.4)
-
-
KmsException–This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.
-
NoManagementAccountSLRExistsException–This exception is thrown when the management account does not have a service-linked role.
-
NotOrganizationMasterAccountException–This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.
-
OperationNotPermittedException–This exception is thrown when the requested operation is not permitted.
-
S3BucketDoesNotExistException–This exception is thrown when the specified S3 bucket does not exist.
-
ThrottlingException–This exception is thrown when the request rate exceeds the limit.
-
TrailNotFoundException–This exception is thrown when the trail with the given name is not found.
-
UnsupportedOperationException–This exception is thrown when the requested operation is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cloudtrail/_services/cloud_trail.py
3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 | |