diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/index.tsx index f941cad91d3a4..7d51009dccda3 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/rule_preview/index.tsx @@ -108,6 +108,8 @@ const RulePreviewComponent: React.FC = ({ const [isDateRangeInvalid, setIsDateRangeInvalid] = useState(false); + const isLoggedRequestsSupported = RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType); + useEffect(() => { const { start, end } = refreshedTimeframe(startDate, endDate); setTimeframeStart(start); @@ -194,7 +196,7 @@ const RulePreviewComponent: React.FC = ({ interval: scheduleRuleData.interval, lookback: scheduleRuleData.from, }, - enableLoggedRequests: showElasticsearchRequests, + enableLoggedRequests: showElasticsearchRequests && isLoggedRequestsSupported, }); setIsRefreshing(true); }, [ @@ -205,6 +207,7 @@ const RulePreviewComponent: React.FC = ({ startDate, startTransaction, showElasticsearchRequests, + isLoggedRequestsSupported, ]); const isDirty = useMemo( @@ -279,7 +282,7 @@ const RulePreviewComponent: React.FC = ({ - {RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType) ? ( + {isLoggedRequestsSupported ? ( @@ -312,7 +315,7 @@ const RulePreviewComponent: React.FC = ({ logs={logs} hasNoiseWarning={hasNoiseWarning} isAborted={isAborted} - showElasticsearchRequests={showElasticsearchRequests} + showElasticsearchRequests={showElasticsearchRequests && isLoggedRequestsSupported} /> );