Path: blob/main/production/operator/crds/monitoring.grafana.com_podlogs.yaml
4096 views
---1apiVersion: apiextensions.k8s.io/v12kind: CustomResourceDefinition3metadata:4annotations:5controller-gen.kubebuilder.io/version: v0.9.26creationTimestamp: null7name: podlogs.monitoring.grafana.com8spec:9group: monitoring.grafana.com10names:11categories:12- agent-operator13kind: PodLogs14listKind: PodLogsList15plural: podlogs16singular: podlogs17scope: Namespaced18versions:19- name: v1alpha120schema:21openAPIV3Schema:22description: PodLogs defines how to collect logs for a pod.23properties:24apiVersion:25description: 'APIVersion defines the versioned schema of this representation26of an object. Servers should convert recognized schemas to the latest27internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'28type: string29kind:30description: 'Kind is a string value representing the REST resource this31object represents. Servers may infer this from the endpoint the client32submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'33type: string34metadata:35type: object36spec:37description: Spec holds the specification of the desired behavior for38the PodLogs.39properties:40jobLabel:41description: The label to use to retrieve the job name from.42type: string43namespaceSelector:44description: Selector to select which namespaces the Pod objects are45discovered from.46properties:47any:48description: Boolean describing whether all namespaces are selected49in contrast to a list restricting them.50type: boolean51matchNames:52description: List of namespace names to select from.53items:54type: string55type: array56type: object57pipelineStages:58description: Pipeline stages for this pod. Pipeline stages support59transforming and filtering log lines.60items:61description: "PipelineStageSpec defines an individual pipeline stage.62Each stage type is mutually exclusive and no more than one may63be set per stage. \n More information on pipelines can be found64in the Promtail documentation: https://grafana.com/docs/loki/latest/clients/promtail/pipelines/"65properties:66cri:67description: 'CRI is a parsing stage that reads log lines using68the standard CRI logging format. Supply cri: {} to enable.'69type: object70docker:71description: 'Docker is a parsing stage that reads log lines72using the standard Docker logging format. Supply docker: {}73to enable.'74type: object75drop:76description: Drop is a filtering stage that lets you drop certain77logs.78properties:79dropCounterReason:80description: Every time a log line is dropped, the metric81logentry_dropped_lines_total is incremented. A "reason"82label is added, and can be customized by providing a custom83value here. Defaults to "drop_stage".84type: string85expression:86description: "RE2 regular expression. \n If source is provided,87the regex attempts to match the source. \n If no source88is provided, then the regex attempts to attach the log89line. \n If the provided regex matches the log line or90a provided source, the line is dropped."91type: string92longerThan:93description: LongerThan will drop a log line if it its content94is longer than this value (in bytes). Can be expressed95as an integer (8192) or a number with a suffix (8kb).96type: string97olderThan:98description: OlderThan will be parsed as a Go duration.99If the log line's timestamp is older than the current100time minus the provided duration, it will be dropped.101type: string102source:103description: Name from the extract data to parse. If empty,104uses the log message.105type: string106value:107description: "Value can only be specified when source is108specified. If the value provided is an exact match for109the given source then the line will be dropped. \n Mutually110exclusive with expression."111type: string112type: object113json:114description: "JSON is a parsing stage that reads the log line115as JSON and accepts JMESPath expressions to extract data.116\n Information on JMESPath: http://jmespath.org/"117properties:118expressions:119additionalProperties:120type: string121description: "Set of the key/value pairs of JMESPath expressions.122The key will be the key in the extracted data while the123expression will be the value, evaluated as a JMESPath124from the source data. \n Literal JMESPath expressions125can be used by wrapping a key in double quotes, which126then must be wrapped again in single quotes in YAML so127they get passed to the JMESPath parser."128type: object129source:130description: Name from the extracted data to parse as JSON.131If empty, uses entire log message.132type: string133type: object134labelAllow:135description: LabelAllow is an action stage that only allows136the provided labels to be included in the label set that is137sent to Loki with the log entry.138items:139type: string140type: array141labelDrop:142description: LabelDrop is an action stage that drops labels143from the label set that is sent to Loki with the log entry.144items:145type: string146type: array147labels:148additionalProperties:149type: string150description: "Labels is an action stage that takes data from151the extracted map and modifies the label set that is sent152to Loki with the log entry. \n The key is REQUIRED and represents153the name for the label that will be created. Value is optional154and will be the name from extracted data to use for the value155of the label. If the value is not provided, it defaults to156match the key."157type: object158limit:159description: Limit is a rate-limiting stage that throttles logs160based on several options.161properties:162burst:163description: The cap in the quantity of burst lines that164Promtail will push to Loki.165type: integer166drop:167description: "When drop is true, log lines that exceed the168current rate limit are discarded. When drop is false,169log lines that exceed the current rate limit wait to enter170the back pressure mode. \n Defaults to false."171type: boolean172rate:173description: The rate limit in lines per second that Promtail174will push to Loki.175type: integer176type: object177match:178description: Match is a filtering stage that conditionally applies179a set of stages or drop entries when a log entry matches a180configurable LogQL stream selector and filter expressions.181properties:182action:183description: Determines what action is taken when the selector184matches the log line. Can be keep or drop. Defaults to185keep. When set to drop, entries are dropped and no later186metrics are recorded. Stages must be empty when dropping187metrics.188type: string189dropCounterReason:190description: Every time a log line is dropped, the metric191logentry_dropped_lines_total is incremented. A "reason"192label is added, and can be customized by providing a custom193value here. Defaults to "match_stage."194type: string195pipelineName:196description: Names the pipeline. When defined, creates an197additional label in the pipeline_duration_seconds histogram,198where the value is concatenated with job_name using an199underscore.200type: string201selector:202description: LogQL stream selector and filter expressions.203Required.204type: string205stages:206description: "Nested set of pipeline stages to execute when207action is keep and the log line matches selector. \n An208example value for stages may be: \n stages: | - json:209{} - labelAllow: [foo, bar] \n Note that stages is a string210because SIG API Machinery does not support recursive types,211and so it cannot be validated for correctness. Be careful212not to mistype anything."213type: string214required:215- selector216type: object217metrics:218additionalProperties:219description: MetricsStageSpec is an action stage that allows220for defining and updating metrics based on data from the221extracted map. Created metrics are not pushed to Loki or222Prometheus and are instead exposed via the /metrics endpoint223of the Grafana Agent pod. The Grafana Agent Operator should224be configured with a MetricsInstance that discovers the225logging DaemonSet to collect metrics created by this stage.226properties:227action:228description: "The action to take against the metric. Required.229\n Must be either \"inc\" or \"add\" for type: counter230or type: histogram. When type: gauge, must be one of231\"set\", \"inc\", \"dec\", \"add\", or \"sub\". \n \"add\",232\"set\", or \"sub\" requires the extracted value to233be convertible to a positive float."234type: string235buckets:236description: 'Buckets to create. Bucket values must be237convertible to float64s. Extremely large or small numbers238are subject to some loss of precision. Only valid for239type: histogram.'240items:241type: string242type: array243countEntryBytes:244description: "If true all log line bytes are counted.245Can only be set with matchAll: true and action: add.246\n Only valid for type: counter."247type: boolean248description:249description: Sets the description for the created metric.250type: string251matchAll:252description: "If true, all log lines are counted without253attempting to match the source to the extracted map.254Mutually exclusive with value. \n Only valid for type:255counter."256type: boolean257maxIdleDuration:258description: "Label values on metrics are dynamic which259can cause exported metrics to go stale. To prevent unbounded260cardinality, any metrics not updated within MaxIdleDuration261are removed. \n Must be greater or equal to 1s. Defaults262to 5m."263type: string264prefix:265description: Sets the custom prefix name for the metric.266Defaults to "promtail_custom_".267type: string268source:269description: Key from the extracted data map to use for270the metric. Defaults to the metrics name if not present.271type: string272type:273description: The metric type to create. Must be one of274counter, gauge, histogram. Required.275type: string276value:277description: Filters down source data and only changes278the metric if the targeted value matches the provided279string exactly. If not present, all data matches.280type: string281required:282- action283- type284type: object285description: Metrics is an action stage that supports defining286and updating metrics based on data from the extracted map.287Created metrics are not pushed to Loki or Prometheus and are288instead exposed via the /metrics endpoint of the Grafana Agent289pod. The Grafana Agent Operator should be configured with290a MetricsInstance that discovers the logging DaemonSet to291collect metrics created by this stage.292type: object293multiline:294description: Multiline stage merges multiple lines into a multiline295block before passing it on to the next stage in the pipeline.296properties:297firstLine:298description: RE2 regular expression. Creates a new multiline299block when matched. Required.300type: string301maxLines:302description: Maximum number of lines a block can have. A303new block is started if the number of lines surpasses304this value. Defaults to 128.305type: integer306maxWaitTime:307description: Maximum time to wait before passing on the308multiline block to the next stage if no new lines are309received. Defaults to 3s.310type: string311required:312- firstLine313type: object314output:315description: Output stage is an action stage that takes data316from the extracted map and changes the log line that will317be sent to Loki.318properties:319source:320description: Name from extract data to use for the log entry.321Required.322type: string323required:324- source325type: object326pack:327description: Pack is a transform stage that lets you embed extracted328values and labels into the log line by packing the log line329and labels inside of a JSON object.330properties:331ingestTimestamp:332description: If the resulting log line should use any existing333timestamp or use time.Now() when the line was created.334Set to true when combining several log streams from different335containers to avoid out of order errors.336type: boolean337labels:338description: Name from extracted data or line labels. Required.339Labels provided here are automatically removed from output340labels.341items:342type: string343type: array344required:345- labels346type: object347regex:348description: Regex is a parsing stage that parses a log line349using a regular expression. Named capture groups in the regex350allows for adding data into the extracted map.351properties:352expression:353description: RE2 regular expression. Each capture group354MUST be named. Required.355type: string356source:357description: Name from extracted data to parse. If empty,358defaults to using the log message.359type: string360required:361- expression362type: object363replace:364description: Replace is a parsing stage that parses a log line365using a regular expression and replaces the log line. Named366capture groups in the regex allows for adding data into the367extracted map.368properties:369expression:370description: RE2 regular expression. Each capture group371MUST be named. Required.372type: string373replace:374description: Value to replace the captured group with.375type: string376source:377description: Name from extracted data to parse. If empty,378defaults to using the log message.379type: string380required:381- expression382type: object383template:384description: Template is a transform stage that manipulates385the values in the extracted map using Go's template syntax.386properties:387source:388description: Name from extracted data to parse. Required.389If empty, defaults to using the log message.390type: string391template:392description: Go template string to use. Required. In addition393to normal template functions, ToLower, ToUpper, Replace,394Trim, TrimLeft, TrimRight, TrimPrefix, and TrimSpace are395also available.396type: string397required:398- source399- template400type: object401tenant:402description: Tenant is an action stage that sets the tenant403ID for the log entry picking it from a field in the extracted404data map. If the field is missing, the default LogsClientSpec.tenantId405will be used.406properties:407label:408description: Name from labels whose value should be set409as tenant ID. Mutually exclusive with source and value.410type: string411source:412description: Name from extracted data to use as the tenant413ID. Mutually exclusive with label and value.414type: string415value:416description: Value to use for the template ID. Useful when417this stage is used within a conditional pipeline such418as match. Mutually exclusive with label and source.419type: string420type: object421timestamp:422description: Timestamp is an action stage that can change the423timestamp of a log line before it is sent to Loki. If not424present, the timestamp of a log line defaults to the time425when the log line was read.426properties:427actionOnFailure:428description: Action to take when the timestamp can't be429extracted or parsed. Can be skip or fudge. Defaults to430fudge.431type: string432fallbackFormats:433description: Fallback formats to try if format fails.434items:435type: string436type: array437format:438description: 'Determines format of the time string. Required.439Can be one of: ANSIC, UnixDate, RubyDate, RFC822, RFC822Z,440RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Unix,441UnixMs, UnixUs, UnixNs.'442type: string443location:444description: IANA Timezone Database string.445type: string446source:447description: Name from extracted data to use as the timestamp.448Required.449type: string450required:451- format452- source453type: object454type: object455type: array456podTargetLabels:457description: PodTargetLabels transfers labels on the Kubernetes Pod458onto the target.459items:460type: string461type: array462relabelings:463description: "RelabelConfigs to apply to logs before delivering. Grafana464Agent Operator automatically adds relabelings for a few standard465Kubernetes fields and replaces original scrape job name with __tmp_logs_job_name.466\n More info: https://grafana.com/docs/loki/latest/clients/promtail/configuration/#relabel_configs"467items:468description: 'RelabelConfig allows dynamic rewriting of the label469set, being applied to samples before ingestion. It defines `<metric_relabel_configs>`-section470of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'471properties:472action:473default: replace474description: Action to perform based on regex matching. Default475is 'replace'. uppercase and lowercase actions require Prometheus476>= 2.36.477enum:478- replace479- Replace480- keep481- Keep482- drop483- Drop484- hashmod485- HashMod486- labelmap487- LabelMap488- labeldrop489- LabelDrop490- labelkeep491- LabelKeep492- lowercase493- Lowercase494- uppercase495- Uppercase496type: string497modulus:498description: Modulus to take of the hash of the source label499values.500format: int64501type: integer502regex:503description: Regular expression against which the extracted504value is matched. Default is '(.*)'505type: string506replacement:507description: Replacement value against which a regex replace508is performed if the regular expression matches. Regex capture509groups are available. Default is '$1'510type: string511separator:512description: Separator placed between concatenated source label513values. default is ';'.514type: string515sourceLabels:516description: The source labels select values from existing labels.517Their content is concatenated using the configured separator518and matched against the configured regular expression for519the replace, keep, and drop actions.520items:521description: LabelName is a valid Prometheus label name which522may only contain ASCII letters, numbers, as well as underscores.523pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$524type: string525type: array526targetLabel:527description: Label to which the resulting value is written in528a replace action. It is mandatory for replace actions. Regex529capture groups are available.530type: string531type: object532type: array533selector:534description: Selector to select Pod objects. Required.535properties:536matchExpressions:537description: matchExpressions is a list of label selector requirements.538The requirements are ANDed.539items:540description: A label selector requirement is a selector that541contains values, a key, and an operator that relates the key542and values.543properties:544key:545description: key is the label key that the selector applies546to.547type: string548operator:549description: operator represents a key's relationship to550a set of values. Valid operators are In, NotIn, Exists551and DoesNotExist.552type: string553values:554description: values is an array of string values. If the555operator is In or NotIn, the values array must be non-empty.556If the operator is Exists or DoesNotExist, the values557array must be empty. This array is replaced during a strategic558merge patch.559items:560type: string561type: array562required:563- key564- operator565type: object566type: array567matchLabels:568additionalProperties:569type: string570description: matchLabels is a map of {key,value} pairs. A single571{key,value} in the matchLabels map is equivalent to an element572of matchExpressions, whose key field is "key", the operator573is "In", and the values array contains only "value". The requirements574are ANDed.575type: object576type: object577x-kubernetes-map-type: atomic578required:579- selector580type: object581type: object582served: true583storage: true584585586