Loki full CPU for a long time and need restart to work again

There are a couple of configurations that you can use to control how many chunks get written, such as max_chunk_age, chunk_idle_period, and chunk_target_size. Make sure to also adjust query_ingesters_within to match.

As for splitting queries, split_queries_by_interval is what you want. You can change that to 12h or 24h for example and see how it performs.