diff --git a/.chloggen/f_hints_logs.yaml b/.chloggen/f_hints_logs.yaml new file mode 100644 index 000000000000..9e4b274aefbf --- /dev/null +++ b/.chloggen/f_hints_logs.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receivercreator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add support for starting logs' collection based on provided k8s annotations' hints + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34427] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/receivercreator/README.md b/receiver/receivercreator/README.md index ac836eb98e02..4fe12d38bcbe 100644 --- a/receiver/receivercreator/README.md +++ b/receiver/receivercreator/README.md @@ -458,7 +458,8 @@ receiver_creator/metrics: # ignore_receivers: [] ``` -Find bellow the supported annotations that user can define to automatically enable receivers to start collecting metrics signals from the target Pods/containers. +Find bellow the supported annotations that user can define to automatically enable receivers to start +collecting metrics and logs signals from the target Pods/containers. ### Supported metrics annotations @@ -511,11 +512,76 @@ The current implementation relies on the implementation of `k8sobserver` extensi the [pod_endpoint](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.111.0/extension/observer/k8sobserver/pod_endpoint.go). The hints are evaluated per container by extracting the annotations from each [`Port` endpoint](#Port) that is emitted. +### Supported logs annotations + +This feature enables `filelog` receiver in order to collect logs from the discovered Pods. + +#### Enable/disable discovery + +`io.opentelemetry.discovery.logs/enabled` (Required. Example: `"true"`) + +By default `"false"`. + +#### Define configuration + +The default configuration for the `filelog` receiver is the following: + +```yaml +include: + - /var/log/pods/`pod.namespace`_`pod.name`_`pod.uid`/`container_name`/*.log +include_file_name: false +include_file_path: true +operators: + - id: container-parser + type: container +``` +This default can be extended or overridden using the respective annotation: +`io.opentelemetry.discovery.logs/config` + +**Example:** + +```yaml +io.opentelemetry.discovery.logs/config: | + include_file_name: true + max_log_size: "2MiB" + operators: + - type: container + id: container-parser + - type: regex_parser + regex: "^(?P