diff --git a/packages/grafana-ui/src/components/Logs/LogMessageAnsi.tsx b/packages/grafana-ui/src/components/Logs/LogMessageAnsi.tsx index b7633b714b5..918ff631cc3 100644 --- a/packages/grafana-ui/src/components/Logs/LogMessageAnsi.tsx +++ b/packages/grafana-ui/src/components/Logs/LogMessageAnsi.tsx @@ -82,6 +82,7 @@ export class UnThemedLogMessageAnsi extends PureComponent { return chunks.map((chunk, index) => { const chunkText = this.props.highlight?.searchWords ? ( () as React.RefObject; useLayoutEffect(() => { - if (shouldScrollToBottom && listContainerRef.current) { + // We want to scroll to bottom only when we receive first 10 log lines + const shouldScrollRows = rows.length > 0 && rows.length <= 10; + if (shouldScrollToBottom && shouldScrollRows && listContainerRef.current) { setScrollTop(listContainerRef.current.offsetHeight); } - }, [shouldScrollToBottom]); + }, [shouldScrollToBottom, rows]); const headerProps = { row,