Grafana Alloy is the new name for our distribution of the OTel collector.
Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025.
Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025.
Read more about why we recommend migrating to
Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Deployment is a set of discovered resources relative to a GrafanaAgent. The tree of resources contained in a Deployment form the resource hierarchy used for reconciling a GrafanaAgent.
APIServerConfig lets you specify a host and auth methods to access the Kubernetes API server. If left empty, the Agent assumes that it is running inside of the cluster and will discover API servers automatically and use the pod's CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount.
PodMetadata configures Labels and Annotations which are propagated to created Grafana Agent pods.
version string
Version of Grafana Agent to be deployed.
paused bool
Paused prevents actions except for deletion to be performed on the underlying managed objects.
image string
Image, when specified, overrides the image used to run Agent. Specify the image along with a tag. You still need to set the version to ensure Grafana Agent Operator knows which version of Grafana Agent is being configured.
Volumes allows configuration of additional volumes on the output StatefulSet definition. The volumes specified are appended to other volumes that are generated as a result of StorageSpec objects.
VolumeMounts lets you configure additional VolumeMounts on the output StatefulSet definition. Specified VolumeMounts are appended to other VolumeMounts generated as a result of StorageSpec objects in the Grafana Agent container.
Resources holds requests and limits for individual pods.
nodeSelector map[string]string
NodeSelector defines which nodes pods should be scheduling on.
serviceAccountName string
ServiceAccountName is the name of the ServiceAccount to use for running Grafana Agent pods.
secrets []string
Secrets is a list of secrets in the same namespace as the GrafanaAgent object which will be mounted into each running Grafana Agent pod. The secrets are mounted into /etc/grafana-agent/extra-secrets/<secret-name>.
configMaps []string
ConfigMaps is a list of config maps in the same namespace as the GrafanaAgent object which will be mounted into each running Grafana Agent pod. The ConfigMaps are mounted into /etc/grafana-agent/extra-configmaps/<configmap-name>.
Containers lets you inject additional containers or modify operator-generated containers. This can be used to add an authentication proxy to a Grafana Agent pod or to change the behavior of an operator-generated container. Containers described here modify an operator-generated container if they share the same name and if modifications are done via a strategic merge patch. The current container names are: grafana-agent and config-reloader. Overriding containers is entirely outside the scope of what the Grafana Agent team supports and by doing so, you accept that this behavior may break at any time without notice.
InitContainers let you add initContainers to the pod definition. These can be used to, for example, fetch secrets for injection into the Grafana Agent configuration from external sources. Errors during the execution of an initContainer cause the pod to restart. More info:
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ Using initContainers for any use case other than secret fetching is entirely outside the scope of what the Grafana Agent maintainers support and by doing so, you accept that this behavior may break at any time without notice.
priorityClassName string
PriorityClassName is the priority class assigned to pods.
portName string
Port name used for the pods and governing service. This defaults to agent-metrics.
(Appears on:
PipelineStageSpec)
CRIStageSpec is a parsing stage that reads log lines using the standard CRI logging format. It needs no defined fields.
DockerStageSpec
(Appears on:
PipelineStageSpec)
DockerStageSpec is a parsing stage that reads log lines using the standard Docker logging format. It needs no defined fields.
DropStageSpec
(Appears on:
PipelineStageSpec)
DropStageSpec is a filtering stage that lets you drop certain logs.
Fields
Field
Description
source string
Name from the extract data to parse. If empty, uses the log message.
expression string
RE2 regular expression. If source is provided, the regex attempts to match the source. If no source is provided, then the regex attempts to attach the log line. If the provided regex matches the log line or a provided source, the line is dropped.
value string
Value can only be specified when source is specified. If the value provided is an exact match for the given source then the line will be dropped. Mutually exclusive with expression.
olderThan string
OlderThan will be parsed as a Go duration. If the log line's timestamp is older than the current time minus the provided duration, it will be dropped.
longerThan string
LongerThan will drop a log line if it its content is longer than this value (in bytes). Can be expressed as an integer (8192) or a number with a suffix (8kb).
dropCounterReason string
Every time a log line is dropped, the metric logentry_dropped_lines_total is incremented. A "reason" label is added, and can be customized by providing a custom value here. Defaults to "drop_stage".
GrafanaAgentSpec
(Appears on:
GrafanaAgent)
GrafanaAgentSpec is a specification of the desired behavior of the Grafana Agent cluster.
Fields
Field
Description
logLevel string
LogLevel controls the log level of the generated pods. Defaults to "info" if not set.
logFormat string
LogFormat controls the logging format of the generated pods. Defaults to "logfmt" if not set.
APIServerConfig lets you specify a host and auth methods to access the Kubernetes API server. If left empty, the Agent assumes that it is running inside of the cluster and will discover API servers automatically and use the pod's CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount.
PodMetadata configures Labels and Annotations which are propagated to created Grafana Agent pods.
version string
Version of Grafana Agent to be deployed.
paused bool
Paused prevents actions except for deletion to be performed on the underlying managed objects.
image string
Image, when specified, overrides the image used to run Agent. Specify the image along with a tag. You still need to set the version to ensure Grafana Agent Operator knows which version of Grafana Agent is being configured.
Volumes allows configuration of additional volumes on the output StatefulSet definition. The volumes specified are appended to other volumes that are generated as a result of StorageSpec objects.
VolumeMounts lets you configure additional VolumeMounts on the output StatefulSet definition. Specified VolumeMounts are appended to other VolumeMounts generated as a result of StorageSpec objects in the Grafana Agent container.
Resources holds requests and limits for individual pods.
nodeSelector map[string]string
NodeSelector defines which nodes pods should be scheduling on.
serviceAccountName string
ServiceAccountName is the name of the ServiceAccount to use for running Grafana Agent pods.
secrets []string
Secrets is a list of secrets in the same namespace as the GrafanaAgent object which will be mounted into each running Grafana Agent pod. The secrets are mounted into /etc/grafana-agent/extra-secrets/<secret-name>.
configMaps []string
ConfigMaps is a list of config maps in the same namespace as the GrafanaAgent object which will be mounted into each running Grafana Agent pod. The ConfigMaps are mounted into /etc/grafana-agent/extra-configmaps/<configmap-name>.
Containers lets you inject additional containers or modify operator-generated containers. This can be used to add an authentication proxy to a Grafana Agent pod or to change the behavior of an operator-generated container. Containers described here modify an operator-generated container if they share the same name and if modifications are done via a strategic merge patch. The current container names are: grafana-agent and config-reloader. Overriding containers is entirely outside the scope of what the Grafana Agent team supports and by doing so, you accept that this behavior may break at any time without notice.
InitContainers let you add initContainers to the pod definition. These can be used to, for example, fetch secrets for injection into the Grafana Agent configuration from external sources. Errors during the execution of an initContainer cause the pod to restart. More info:
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ Using initContainers for any use case other than secret fetching is entirely outside the scope of what the Grafana Agent maintainers support and by doing so, you accept that this behavior may break at any time without notice.
priorityClassName string
PriorityClassName is the priority class assigned to pods.
portName string
Port name used for the pods and governing service. This defaults to agent-metrics.
Integrations controls the integration subsystem of the Agent and settings unique to deployed integration-specific pods.
enableConfigReadAPI bool
enableConfigReadAPI enables the read API for viewing the currently running config port 8080 on the agent. +kubebuilder:default=false
disableReporting bool
disableReporting disables reporting of enabled feature flags to Grafana. +kubebuilder:default=false
disableSupportBundle bool
disableSupportBundle disables the generation of support bundles. +kubebuilder:default=false
Integration
(Appears on:
IntegrationsDeployment)
Integration runs a single Grafana Agent integration. Integrations that generate telemetry must be configured to send that telemetry somewhere, such as autoscrape for exporter-based integrations. Integrations have access to the LogsInstances and MetricsInstances in the same GrafanaAgent resource set, referenced by the <namespace>/<name> of the Instance resource. For example, if there is a default/production MetricsInstance, you can configure a supported integration's autoscrape block with: autoscrape: enable: true metrics_instance: default/production There is currently no way for telemetry created by an Operator-managed integration to be collected from outside of the integration itself.
An extra list of Volumes to be associated with the Grafana Agent pods running this integration. Volume names are mutated to be unique across all Integrations. Note that the specified volumes should be able to tolerate existing on multiple pods at once when type is daemonset. Don't use volumes for loading Secrets or ConfigMaps from the same namespace as the Integration; use the Secrets and ConfigMaps fields instead.
An extra list of VolumeMounts to be associated with the Grafana Agent pods running this integration. VolumeMount names are mutated to be unique across all used IntegrationSpecs. Mount paths should include the namespace/name of the Integration CR to avoid potentially colliding with other resources.
An extra list of keys from Secrets in the same namespace as the Integration which will be mounted into the Grafana Agent pod running this Integration. Secrets will be mounted at /etc/grafana-agent/integrations/secrets/<secret_namespace>/<secret_name>/<key>.
An extra list of keys from ConfigMaps in the same namespace as the Integration which will be mounted into the Grafana Agent pod running this Integration. ConfigMaps are mounted at /etc/grafana-agent/integrations/configMaps/<configmap_namespace>/<configmap_name>/<key>.
IntegrationSpec
(Appears on:
Integration)
IntegrationSpec specifies the desired behavior of a metrics integration.
Fields
Field
Description
name string
Name of the integration to run (e.g., "node_exporter", "mysqld_exporter").
An extra list of Volumes to be associated with the Grafana Agent pods running this integration. Volume names are mutated to be unique across all Integrations. Note that the specified volumes should be able to tolerate existing on multiple pods at once when type is daemonset. Don't use volumes for loading Secrets or ConfigMaps from the same namespace as the Integration; use the Secrets and ConfigMaps fields instead.
An extra list of VolumeMounts to be associated with the Grafana Agent pods running this integration. VolumeMount names are mutated to be unique across all used IntegrationSpecs. Mount paths should include the namespace/name of the Integration CR to avoid potentially colliding with other resources.
An extra list of keys from Secrets in the same namespace as the Integration which will be mounted into the Grafana Agent pod running this Integration. Secrets will be mounted at /etc/grafana-agent/integrations/secrets/<secret_namespace>/<secret_name>/<key>.
An extra list of keys from ConfigMaps in the same namespace as the Integration which will be mounted into the Grafana Agent pod running this Integration. ConfigMaps are mounted at /etc/grafana-agent/integrations/configMaps/<configmap_namespace>/<configmap_name>/<key>.
IntegrationType
(Appears on:
IntegrationSpec)
IntegrationType determines specific behaviors of a configured integration.
Fields
Field
Description
allNodes bool
When true, the configured integration should be run on every Node in the cluster. This is required for Integrations that generate Node-specific metrics like node_exporter, otherwise it must be false to avoid generating duplicate metrics.
unique bool
Whether this integration can only be defined once for a Grafana Agent process, such as statsd_exporter. It is invalid for a GrafanaAgent to discover multiple unique Integrations with the same Integration name (i.e., a single GrafanaAgent cannot deploy two statsd_exporters).
IntegrationsSubsystemSpec
(Appears on:
GrafanaAgentSpec)
IntegrationsSubsystemSpec defines global settings to apply across the integrations subsystem.
Label selector for namespaces to search when discovering integration resources. If nil, integration resources are only discovered in the namespace of the GrafanaAgent resource. Set to {} to search all namespaces.
JSONStageSpec
(Appears on:
PipelineStageSpec)
JSONStageSpec is a parsing stage that reads the log line as JSON and accepts JMESPath expressions to extract data.
Fields
Field
Description
source string
Name from the extracted data to parse as JSON. If empty, uses entire log message.
expressions map[string]string
Set of the key/value pairs of JMESPath expressions. The key will be the key in the extracted data while the expression will be the value, evaluated as a JMESPath from the source data. Literal JMESPath expressions can be used by wrapping a key in double quotes, which then must be wrapped again in single quotes in YAML so they get passed to the JMESPath parser.
LimitStageSpec
(Appears on:
PipelineStageSpec)
The limit stage is a rate-limiting stage that throttles logs based on several options.
Fields
Field
Description
rate int
The rate limit in lines per second that Promtail will push to Loki.
burst int
The cap in the quantity of burst lines that Promtail will push to Loki.
drop bool
When drop is true, log lines that exceed the current rate limit are discarded. When drop is false, log lines that exceed the current rate limit wait to enter the back pressure mode. Defaults to false.
LogsBackoffConfigSpec
(Appears on:
LogsClientSpec)
LogsBackoffConfigSpec configures timing for retrying failed requests.
Fields
Field
Description
minPeriod string
Initial backoff time between retries. Time between retries is increased exponentially.
maxPeriod string
Maximum backoff time between retries.
maxRetries int
Maximum number of retries to perform before giving up a request.
LogsClientSpec
(Appears on:
LogsInstanceSpec,
LogsSubsystemSpec)
LogsClientSpec defines the client integration for logs, indicating which Loki server to send logs to.
Tenant ID used by default to push logs to Loki. If omitted assumes remote Loki is running in single-tenant mode or an authentication layer is used to inject an X-Scope-OrgID header.
batchWait string
Maximum amount of time to wait before sending a batch, even if that batch isn't full.
batchSize int
Maximum batch size (in bytes) of logs to accumulate before sending the batch to Loki.
AdditionalScrapeConfigs allows specifying a key of a Secret containing additional Grafana Agent logging scrape configurations. Scrape configurations specified are appended to the configurations generated by the Grafana Agent Operator. Job configurations specified must have the form as specified in the official Promtail documentation:
https://grafana.com/docs/loki/latest/clients/promtail/configuration/#scrape_configs As scrape configs are appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility to break upgrades of Grafana Agent. It is advised to review both Grafana Agent and Promtail release notes to ensure that no incompatible scrape configs are going to break Grafana Agent after the upgrade.
AdditionalScrapeConfigs allows specifying a key of a Secret containing additional Grafana Agent logging scrape configurations. Scrape configurations specified are appended to the configurations generated by the Grafana Agent Operator. Job configurations specified must have the form as specified in the official Promtail documentation:
https://grafana.com/docs/loki/latest/clients/promtail/configuration/#scrape_configs As scrape configs are appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility to break upgrades of Grafana Agent. It is advised to review both Grafana Agent and Promtail release notes to ensure that no incompatible scrape configs are going to break Grafana Agent after the upgrade.
A global set of clients to use when a discovered LogsInstance does not have any clients defined.
logsExternalLabelName string
LogsExternalLabelName is the name of the external label used to denote Grafana Agent cluster. Defaults to "cluster." External label will not be added when value is set to the empty string.
InstanceSelector determines which LogInstances should be selected for running. Each instance runs its own set of Prometheus components, including service discovery, scraping, and remote_write.
InstanceNamespaceSelector are the set of labels to determine which namespaces to watch for LogInstances. If not provided, only checks own namespace.
ignoreNamespaceSelectors bool
IgnoreNamespaceSelectors, if true, will ignore NamespaceSelector settings from the PodLogs configs, and they will only discover endpoints within their current namespace.
enforcedNamespaceLabel string
EnforcedNamespaceLabel enforces adding a namespace label of origin for each metric that is user-created. The label value will always be the namespace of the object that is being created.
LogsTargetConfigSpec
(Appears on:
LogsInstanceSpec)
LogsTargetConfigSpec configures how tailed targets are watched.
Fields
Field
Description
syncPeriod string
Period to resync directories being watched and files being tailed to discover new ones or stop watching removed ones.
MatchStageSpec
(Appears on:
PipelineStageSpec)
MatchStageSpec is a filtering stage that conditionally applies a set of stages or drop entries when a log entry matches a configurable LogQL stream selector and filter expressions.
Fields
Field
Description
selector string
LogQL stream selector and filter expressions. Required.
pipelineName string
Names the pipeline. When defined, creates an additional label in the pipeline_duration_seconds histogram, where the value is concatenated with job_name using an underscore.
action string
Determines what action is taken when the selector matches the log line. Can be keep or drop. Defaults to keep. When set to drop, entries are dropped and no later metrics are recorded. Stages must be empty when dropping metrics.
dropCounterReason string
Every time a log line is dropped, the metric logentry_dropped_lines_total is incremented. A "reason" label is added, and can be customized by providing a custom value here. Defaults to "match_stage."
stages string
Nested set of pipeline stages to execute when action is keep and the log line matches selector. An example value for stages may be: stages:
MetadataConfig
(Appears on:
RemoteWriteSpec)
MetadataConfig configures the sending of series metadata to remote storage.
Fields
Field
Description
send bool
Send enables metric metadata to be sent to remote storage.
sendInterval string
SendInterval controls how frequently metric metadata is sent to remote storage.
MetricsInstance
(Appears on:
MetricsDeployment)
MetricsInstance controls an individual Metrics instance within a Grafana Agent deployment.
Spec holds the specification of the desired behavior for the Metrics instance.
walTruncateFrequency string
WALTruncateFrequency specifies how frequently to run the WAL truncation process. Higher values cause the WAL to increase and for old series to stay in the WAL longer, but reduces the chance of data loss when remote_write fails for longer than the given frequency.
minWALTime string
MinWALTime is the minimum amount of time that series and samples can exist in the WAL before being considered for deletion.
maxWALTime string
MaxWALTime is the maximum amount of time that series and samples can exist in the WAL before being forcibly deleted.
remoteFlushDeadline string
RemoteFlushDeadline is the deadline for flushing data when an instance shuts down.
writeStaleOnShutdown bool
WriteStaleOnShutdown writes staleness markers on shutdown for all series.
ServiceMonitorNamespaceSelector is the set of labels that determine which namespaces to watch for ServiceMonitor discovery. If nil, it only checks its own namespace.
PodMonitorNamespaceSelector are the set of labels to determine which namespaces to watch for PodMonitor discovery. If nil, it only checks its own namespace.
AdditionalScrapeConfigs lets you specify a key of a Secret containing additional Grafana Agent Prometheus scrape configurations. The specified scrape configurations are appended to the configurations generated by Grafana Agent Operator. Specified job configurations must have the form specified in the official Prometheus documentation:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. As scrape configs are appended, you must make sure the configuration is still valid. Note that it's possible that this feature will break future upgrades of Grafana Agent. Review both Grafana Agent and Prometheus release notes to ensure that no incompatible scrape configs will break Grafana Agent after the upgrade.
MetricsInstanceSpec
(Appears on:
MetricsInstance)
MetricsInstanceSpec controls how an individual instance is used to discover PodMonitors.
Fields
Field
Description
walTruncateFrequency string
WALTruncateFrequency specifies how frequently to run the WAL truncation process. Higher values cause the WAL to increase and for old series to stay in the WAL longer, but reduces the chance of data loss when remote_write fails for longer than the given frequency.
minWALTime string
MinWALTime is the minimum amount of time that series and samples can exist in the WAL before being considered for deletion.
maxWALTime string
MaxWALTime is the maximum amount of time that series and samples can exist in the WAL before being forcibly deleted.
remoteFlushDeadline string
RemoteFlushDeadline is the deadline for flushing data when an instance shuts down.
writeStaleOnShutdown bool
WriteStaleOnShutdown writes staleness markers on shutdown for all series.
ServiceMonitorNamespaceSelector is the set of labels that determine which namespaces to watch for ServiceMonitor discovery. If nil, it only checks its own namespace.
PodMonitorNamespaceSelector are the set of labels to determine which namespaces to watch for PodMonitor discovery. If nil, it only checks its own namespace.
AdditionalScrapeConfigs lets you specify a key of a Secret containing additional Grafana Agent Prometheus scrape configurations. The specified scrape configurations are appended to the configurations generated by Grafana Agent Operator. Specified job configurations must have the form specified in the official Prometheus documentation:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. As scrape configs are appended, you must make sure the configuration is still valid. Note that it's possible that this feature will break future upgrades of Grafana Agent. Review both Grafana Agent and Prometheus release notes to ensure that no incompatible scrape configs will break Grafana Agent after the upgrade.
MetricsStageSpec
(Appears on:
PipelineStageSpec)
MetricsStageSpec is an action stage that allows for defining and updating metrics based on data from the extracted map. Created metrics are not pushed to Loki or Prometheus and are instead exposed via the /metrics endpoint of the Grafana Agent pod. The Grafana Agent Operator should be configured with a MetricsInstance that discovers the logging DaemonSet to collect metrics created by this stage.
Fields
Field
Description
type string
The metric type to create. Must be one of counter, gauge, histogram. Required.
description string
Sets the description for the created metric.
prefix string
Sets the custom prefix name for the metric. Defaults to "promtail_custom_".
source string
Key from the extracted data map to use for the metric. Defaults to the metrics name if not present.
maxIdleDuration string
Label values on metrics are dynamic which can cause exported metrics to go stale. To prevent unbounded cardinality, any metrics not updated within MaxIdleDuration are removed. Must be greater or equal to 1s. Defaults to 5m.
matchAll bool
If true, all log lines are counted without attempting to match the source to the extracted map. Mutually exclusive with value. Only valid for type: counter.
countEntryBytes bool
If true all log line bytes are counted. Can only be set with matchAll: true and action: add. Only valid for type: counter.
value string
Filters down source data and only changes the metric if the targeted value matches the provided string exactly. If not present, all data matches.
action string
The action to take against the metric. Required. Must be either "inc" or "add" for type: counter or type: histogram. When type: gauge, must be one of "set", "inc", "dec", "add", or "sub". "add", "set", or "sub" requires the extracted value to be convertible to a positive float.
buckets []string
Buckets to create. Bucket values must be convertible to float64s. Extremely large or small numbers are subject to some loss of precision. Only valid for type: histogram.
MetricsSubsystemSpec
(Appears on:
GrafanaAgentSpec)
MetricsSubsystemSpec defines global settings to apply across the Metrics subsystem.
RemoteWrite controls default remote_write settings for all instances. If an instance does not provide its own RemoteWrite settings, these will be used instead.
replicas int32
Replicas of each shard to deploy for metrics pods. Number of replicas multiplied by the number of shards is the total number of pods created.
shards int32
Shards to distribute targets onto. Number of replicas multiplied by the number of shards is the total number of pods created. Note that scaling down shards does not reshard data onto remaining instances; it must be manually moved. Increasing shards does not reshard data either, but it will continue to be available from the same instances. Sharding is performed on the content of the address target meta-label.
replicaExternalLabelName string
ReplicaExternalLabelName is the name of the metrics external label used to denote the replica name. Defaults to replica. The external label is not added when the value is set to the empty string.
metricsExternalLabelName string
MetricsExternalLabelName is the name of the external label used to denote Grafana Agent cluster. Defaults to "cluster." The external label is not added when the value is set to the empty string.
scrapeInterval string
ScrapeInterval is the time between consecutive scrapes.
scrapeTimeout string
ScrapeTimeout is the time to wait for a target to respond before marking a scrape as failed.
externalLabels map[string]string
ExternalLabels are labels to add to any time series when sending data over remote_write.
ArbitraryFSAccessThroughSMs configures whether configuration based on a ServiceMonitor can access arbitrary files on the file system of the Grafana Agent container, e.g., bearer token files.
overrideHonorLabels bool
OverrideHonorLabels, if true, overrides all configured honor_labels read from ServiceMonitor or PodMonitor and sets them to false.
overrideHonorTimestamps bool
OverrideHonorTimestamps allows global enforcement for honoring timestamps in all scrape configs.
ignoreNamespaceSelectors bool
IgnoreNamespaceSelectors, if true, ignores NamespaceSelector settings from the PodMonitor and ServiceMonitor configs, so that they only discover endpoints within their current namespace.
enforcedNamespaceLabel string
EnforcedNamespaceLabel enforces adding a namespace label of origin for each metric that is user-created. The label value is always the namespace of the object that is being created.
enforcedSampleLimit uint64
EnforcedSampleLimit defines a global limit on the number of scraped samples that are accepted. This overrides any SampleLimit set per ServiceMonitor and/or PodMonitor. It is meant to be used by admins to enforce the SampleLimit to keep the overall number of samples and series under the desired limit. Note that if a SampleLimit from a ServiceMonitor or PodMonitor is lower, that value is used instead.
enforcedTargetLimit uint64
EnforcedTargetLimit defines a global limit on the number of scraped targets. This overrides any TargetLimit set per ServiceMonitor and/or PodMonitor. It is meant to be used by admins to enforce the TargetLimit to keep the overall number of targets under the desired limit. Note that if a TargetLimit from a ServiceMonitor or PodMonitor is higher, that value is used instead.
InstanceSelector determines which MetricsInstances should be selected for running. Each instance runs its own set of Metrics components, including service discovery, scraping, and remote_write.
InstanceNamespaceSelector is the set of labels that determines which namespaces to watch for MetricsInstances. If not provided, it only checks its own namespace.
MultilineStageSpec
(Appears on:
PipelineStageSpec)
MultilineStageSpec merges multiple lines into a multiline block before passing it on to the next stage in the pipeline.
Fields
Field
Description
firstLine string
RE2 regular expression. Creates a new multiline block when matched. Required.
maxWaitTime string
Maximum time to wait before passing on the multiline block to the next stage if no new lines are received. Defaults to 3s.
maxLines int
Maximum number of lines a block can have. A new block is started if the number of lines surpasses this value. Defaults to 128.
ObjectSelector
ObjectSelector is a set of selectors to use for finding an object in the resource hierarchy. When NamespaceSelector is nil, search for objects directly in the ParentNamespace.
(Appears on:
PipelineStageSpec)
OutputStageSpec is an action stage that takes data from the extracted map and changes the log line that will be sent to Loki.
Fields
Field
Description
source string
Name from extract data to use for the log entry. Required.
PackStageSpec
(Appears on:
PipelineStageSpec)
PackStageSpec is a transform stage that lets you embed extracted values and labels into the log line by packing the log line and labels inside of a JSON object.
Fields
Field
Description
labels []string
Name from extracted data or line labels. Required. Labels provided here are automatically removed from output labels.
ingestTimestamp bool
If the resulting log line should use any existing timestamp or use time.Now() when the line was created. Set to true when combining several log streams from different containers to avoid out of order errors.
PipelineStageSpec
(Appears on:
PodLogsSpec)
PipelineStageSpec defines an individual pipeline stage. Each stage type is mutually exclusive and no more than one may be set per stage. More information on pipelines can be found in the Promtail documentation:
https://grafana.com/docs/loki/latest/clients/promtail/pipelines/
JSON is a parsing stage that reads the log line as JSON and accepts JMESPath expressions to extract data. Information on JMESPath:
http://jmespath.org/
labelAllow []string
LabelAllow is an action stage that only allows the provided labels to be included in the label set that is sent to Loki with the log entry.
labelDrop []string
LabelDrop is an action stage that drops labels from the label set that is sent to Loki with the log entry.
labels map[string]string
Labels is an action stage that takes data from the extracted map and modifies the label set that is sent to Loki with the log entry. The key is REQUIRED and represents the name for the label that will be created. Value is optional and will be the name from extracted data to use for the value of the label. If the value is not provided, it defaults to match the key.
Match is a filtering stage that conditionally applies a set of stages or drop entries when a log entry matches a configurable LogQL stream selector and filter expressions.
Metrics is an action stage that supports defining and updating metrics based on data from the extracted map. Created metrics are not pushed to Loki or Prometheus and are instead exposed via the /metrics endpoint of the Grafana Agent pod. The Grafana Agent Operator should be configured with a MetricsInstance that discovers the logging DaemonSet to collect metrics created by this stage.
Pack is a transform stage that lets you embed extracted values and labels into the log line by packing the log line and labels inside of a JSON object.
Regex is a parsing stage that parses a log line using a regular expression. Named capture groups in the regex allows for adding data into the extracted map.
Replace is a parsing stage that parses a log line using a regular expression and replaces the log line. Named capture groups in the regex allows for adding data into the extracted map.
Tenant is an action stage that sets the tenant ID for the log entry picking it from a field in the extracted data map. If the field is missing, the default LogsClientSpec.tenantId will be used.
Timestamp is an action stage that can change the timestamp of a log line before it is sent to Loki. If not present, the timestamp of a log line defaults to the time when the log line was read.
PodLogs
(Appears on:
LogsDeployment)
PodLogs defines how to collect logs for a pod.
(Appears on:
RemoteWriteSpec)
QueueConfig allows the tuning of remote_write queue_config parameters.
Fields
Field
Description
capacity int
Capacity is the number of samples to buffer per shard before samples start being dropped.
minShards int
MinShards is the minimum number of shards, i.e., the amount of concurrency.
maxShards int
MaxShards is the maximum number of shards, i.e., the amount of concurrency.
maxSamplesPerSend int
MaxSamplesPerSend is the maximum number of samples per send.
batchSendDeadline string
BatchSendDeadline is the maximum time a sample will wait in the buffer.
maxRetries int
MaxRetries is the maximum number of times to retry a batch on recoverable errors.
minBackoff string
MinBackoff is the initial retry delay. MinBackoff is doubled for every retry.
maxBackoff string
MaxBackoff is the maximum retry delay.
retryOnRateLimit bool
RetryOnRateLimit retries requests when encountering rate limits.
RegexStageSpec
(Appears on:
PipelineStageSpec)
RegexStageSpec is a parsing stage that parses a log line using a regular expression. Named capture groups in the regex allows for adding data into the extracted map.
Fields
Field
Description
source string
Name from extracted data to parse. If empty, defaults to using the log message.
expression string
RE2 regular expression. Each capture group MUST be named. Required.
Name of the remote_write queue. Must be unique if specified. The name is used in metrics and logging in order to differentiate queues.
url string
URL of the endpoint to send samples to.
remoteTimeout string
RemoteTimeout is the timeout for requests to the remote_write endpoint.
headers map[string]string
Headers is a set of custom HTTP headers to be sent along with each remote_write request. Be aware that any headers set by Grafana Agent itself can't be overwritten.
SigV4 configures SigV4-based authentication to the remote_write endpoint. SigV4-based authentication is used if SigV4 is defined, even with an empty object.
MetadataConfig configures the sending of series metadata to remote storage.
ReplaceStageSpec
(Appears on:
PipelineStageSpec)
ReplaceStageSpec is a parsing stage that parses a log line using a regular expression and replaces the log line. Named capture groups in the regex allows for adding data into the extracted map.
Fields
Field
Description
source string
Name from extracted data to parse. If empty, defaults to using the log message.
expression string
RE2 regular expression. Each capture group MUST be named. Required.
replace string
Value to replace the captured group with.
SigV4Config
(Appears on:
RemoteWriteSpec)
SigV4Config specifies configuration to perform SigV4 authentication.
Fields
Field
Description
region string
Region of the AWS endpoint. If blank, the region from the default credentials chain is used.
SecretKey of the AWS API to use for signing. If blank, the environment variable AWS_SECRET_ACCESS_KEY is used.
profile string
Profile is the named AWS profile to use for authentication.
roleARN string
RoleARN is the AWS Role ARN to use for authentication, as an alternative for using the AWS API keys.
TemplateStageSpec
(Appears on:
PipelineStageSpec)
TemplateStageSpec is a transform stage that manipulates the values in the extracted map using Go's template syntax.
Fields
Field
Description
source string
Name from extracted data to parse. Required. If empty, defaults to using the log message.
template string
Go template string to use. Required. In addition to normal template functions, ToLower, ToUpper, Replace, Trim, TrimLeft, TrimRight, TrimPrefix, and TrimSpace are also available.
TenantStageSpec
(Appears on:
PipelineStageSpec)
TenantStageSpec is an action stage that sets the tenant ID for the log entry picking it from a field in the extracted data map.
Fields
Field
Description
label string
Name from labels whose value should be set as tenant ID. Mutually exclusive with source and value.
source string
Name from extracted data to use as the tenant ID. Mutually exclusive with label and value.
value string
Value to use for the template ID. Useful when this stage is used within a conditional pipeline such as match. Mutually exclusive with label and source.
TimestampStageSpec
(Appears on:
PipelineStageSpec)
TimestampStageSpec is an action stage that can change the timestamp of a log line before it is sent to Loki.
Fields
Field
Description
source string
Name from extracted data to use as the timestamp. Required.
format string
Determines format of the time string. Required. Can be one of: ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Unix, UnixMs, UnixUs, UnixNs.
fallbackFormats []string
Fallback formats to try if format fails.
location string
IANA Timezone Database string.
actionOnFailure string
Action to take when the timestamp can't be extracted or parsed. Can be skip or fudge. Defaults to fudge.