I would look at using the makeTimeseries command instead of summarize as documented here DQL aggregation commands — Dynatrace Docs. The third example on that page would likely be the best fit for you. It would probably look something like:
I would however recommend first turning it into a metric on ingest so that you aren’t constantly querying logs for anomaly detection. This would also allow you to reuse the metric on dashboards or in notebooks more easily as well. Docs for that can be found here: Parse log lines and extract a metric — Dynatrace Docs
No, if you take a look at summarize command, there we are trying to collect distinct userIds and all other fields are under “by” section, can we do the same with makeTimeseries
makeTimeseriescommand produces arrays of numbers (track changes of metric value over time), so it will not work with collectDistinct as it produces array of unique user_id values.
What would make sense to have metric “number of unique user_id values” over time. Then you should use countDistinctExact or countDistinctApprox function.