Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][otel] Enable persistence in otel.yml #5549

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2d56cba
chore: update config, docs
VihasMakwana Sep 17, 2024
038027b
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Sep 17, 2024
a82d734
fix: spelling mistake
VihasMakwana Sep 17, 2024
c28889f
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Sep 18, 2024
539931e
fix: go tidy
VihasMakwana Sep 27, 2024
564a619
remove comments
VihasMakwana Sep 27, 2024
36238a3
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Sep 27, 2024
a5cbe5f
fix: go tidy
VihasMakwana Sep 27, 2024
899607a
fix: add filestorage to extension
VihasMakwana Sep 29, 2024
eafd9cd
Update changelog/fragments/1726572104-enable-persistence-by-default.yaml
VihasMakwana Sep 29, 2024
6986051
chore: update readme
VihasMakwana Sep 30, 2024
9be9819
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Sep 30, 2024
b465b1c
chore: update readme
VihasMakwana Oct 4, 2024
44370be
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Oct 4, 2024
5c2aaa1
go.mod
VihasMakwana Oct 4, 2024
afaac31
chore: go.mod
VihasMakwana Oct 4, 2024
d9b667a
comments
VihasMakwana Oct 4, 2024
f66e01f
comments
VihasMakwana Oct 4, 2024
1f0ecc9
chore: update notice
VihasMakwana Oct 4, 2024
b17e355
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Oct 7, 2024
b203fb4
Merge branch 'main' into enabl-file-storage-update-docs
VihasMakwana Oct 8, 2024
eac340c
chore: go.sum and notice
VihasMakwana Oct 8, 2024
5baa9ac
chore: go.sum and notice
VihasMakwana Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: feature

# Change summary; a 80ish characters long description of the change.
summary: Enable persistence in the configuration provided with our OTeL distribution.
VihasMakwana marked this conversation as resolved.
Show resolved Hide resolved

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
#description:

# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
component: elastic-agent,otel

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr:

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
#issue: https://github.com/owner/repo/1234
32 changes: 32 additions & 0 deletions internal/pkg/otel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,35 @@ This section provides a summary of components included in the Elastic Distributi
| Component | Version |
|---|---|
| [spanmetricsconnector](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/connector/spanmetricsconnector/v0.109.0/connector/spanmetricsconnector/README.md) | v0.109.0 |

## Persistence in OpenTelemetry Collector

By default, the OpenTelemetry Collector is stateless, which means it doesn't store offsets on disk while reading files. As a result, if you restart the collector, it won't retain the last read offset, potentially leading to data duplication or loss. However, we have configured persistence in the settings provided with the Elastic Agent package.

To enable persistence for the `filelogreceiver`, we add the `file_storage` extension and activate it for `filelog`. Here’s an example:

```yaml
receivers:
filelog/platformlogs:
include: [ /var/log/system.log ]
start_at: beginning
storage: file_storage/filelogreceiver
extensions:
file_storage/filelogreceiver:
directory: ${env:STORAGE_DIR}
exporters:
...
processors:
...
service:
extensions: [file_storage]
VihasMakwana marked this conversation as resolved.
Show resolved Hide resolved
pipelines:
logs/platformlogs:
receivers: [filelog/platformlogs]
processors: [...]
exporters: [...]
```

> [!WARNING]
Removing the storage key from the filelog section will disable persistence, which will lead to data duplication or loss when the collector restarts.

7 changes: 7 additions & 0 deletions otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ receivers:
filelog:
include: [ /var/log/system.log ]
start_at: beginning
storage: file_storage/filelogreceiver

processors:
resource:
Expand All @@ -24,6 +25,12 @@ extensions:
health_check:
endpoint: "localhost:13133"
path: "/health/status"
file_storage/filelogreceiver:
create_directory: true

# RFC: The text below is just a placeholder.
# Please propose names for the default otel registry.
directory: ${env:STORAGE_DIR}

service:
extensions: [health_check, memory_limiter]
VihasMakwana marked this conversation as resolved.
Show resolved Hide resolved
Expand Down