Per stream export
The Cloud Logs Export feature syncs logs from Grafana Cloud Logs to an object storage bucket that you own. By default, all logs are exported. To save on storage costs, you can use the Per-Stream Export feature to send only a specific subset of your logs to your bucket. You do that by configuring filters with a date range. You’re required to have a valid Cloud Logs Export configuration. For more information, refer to Configure per-stream export
Behavior
- A filter is applicable if the date of the data being exported is within the filter’s date range. The filter’s range is defined by the
startDate
andendDate
properties. If noendDate
is provided,endDate
is set to a date in the future that can’t be reached. - If no filters are applicable for a given time period, all logs are exported. This can happen if no filters are configured, or if their
startDate
has not been reached yet. - If at least one filter is applicable, only data matching the applicable filters are exported.
- You can have multiple filters, each with their own start and end dates.
- The filter
selector
must be a valid LogQL stream selector. For example,{env="production"}
is a valid selector, but{env="production"} |= "error"
is not, because it contains a filter expression. - The
startDate
is only applied to logs that were ingested after thestartDate
. - There is no support for retroactively filtering data. You can define the
startDate
to be a date in the past, but because your logs were already exported, it is as if no filter was defined.
Configure per-stream export
To configure per-stream exports, you define filters that select which log streams to export.
- In your Grafana instance, navigate to Administration > Plugins and data > Plugins.
- Select the Cloud Logs Export plugin.
- In the Configuration tab, click Add new filter.
- For each filter, provide a selector and a startDate. You can also provide an optional endDate to disable the filter after a certain date.
We recommend the
startDate
to be at least 30 days in the past, so configured filters are applied as soon as possible.
For example:
selector=`{region="AMER"}`
startDate="2025-02-01"
or
selector=`{namespace="production", service_name="grafana"}`
startDate="2024-12-05"
Here is an example with an optional endDate
:
selector=`{namespace="production", service_name="grafana"}`
startDate="2024-12-05"
endDate="2025-12-05"