Collecting log files with the OpenTelemetry filelog receiver: when teams need it
The filelog receiver reads log files from disk into an OpenTelemetry Collector pipeline, so teams that write application and system logs to files can stop running a separate log shipper for that job. It tails any file, parses each line with configurable operators or regular expressions, and passes the result on to processors and exporters alongside traces and metrics. Teams should consider it when they already run a Collector on the same hosts, want one configuration and one set of credentials for all telemetry, or need to parse logs at the edge before they leave the host.
Three cases justify the change. The first is one telemetry pipeline: when services already emit traces and metrics through OpenTelemetry, file logs can follow the same route, with shared resource attributes and one place to change exporters. The second is file-only sources, such as legacy applications, batch jobs and appliance exports that cannot send logs over a network protocol. The third is parsing at the edge, where the receiver's parsing operators and the transform processor can turn raw lines into structured fields before data reaches the back end, which can reduce what downstream systems must parse. Confirm each case against your own log volumes and host layout before replacing a working shipper.
OpenTelemetry is not an observability backend. Storage, indexing, search and alerting stay in a separate system, so the filelog receiver only moves and shapes data. Also check stability: the filelog receiver is beta for logs, and its status is documented in the component README. Ask your team to confirm the current stability level for the Collector version you plan to deploy and to review the OpenTelemetry logs documentation for how log signals are modeled before committing.
Filelog receiver options and when each fits
The receiver starts from a set of file paths or glob patterns, and every match becomes a tailed file. Broad globs are convenient on hosts with stable layouts, but they pick up rotated archives, compressed files, and debug dumps that you may not want shipped off the host. Narrow patterns are safer and easier to audit, but they miss files when an application changes its log directory during an upgrade. Exclusion patterns let you remove known noise without rewriting the include list, which is useful when a service writes both application logs and temporary files into the same directory.
- Explicit paths: Lowest risk and easiest to review, but every new log file needs a configuration change.
- Wide globs: Catch new files automatically, and also catch rotated or compressed copies that can duplicate data.
- Exclude patterns: Remove archives, temp files and dumps without narrowing the main pattern.
- Permissions: The Collector process needs read access to every matched file, which often conflicts with least-privilege service accounts.
- Rotation naming: Rotation schemes that rename files change which path a tail follows, so test rotation on a copy of your real setup.
Confirm the exact include and exclude keys, and how rotated files are matched, in the filelog receiver README for the Collector version you run.
Start position controls what happens to lines already in a file when the receiver first sees it, and what happens after a restart. Reading from the beginning is the safer default for a first deployment because it backfills history, but on large existing log directories it can flood the pipeline. Reading only new lines avoids the flood but drops anything written while the Collector was down unless a persistent checkpoint is in place. Discovery frequency decides how quickly new files appear, which matters for applications that create a file per day or per job.
- Beginning of file: Captures history on first run, with a larger initial burst of data.
- End of file: Avoids the backfill but leaves a gap for lines written before the receiver started.
- Poll interval: Shorter intervals find new files sooner and cost more file system activity.
- Restart behavior: Without persisted offsets, a restart may re-read or skip data depending on the start setting.
- Ordering: Files written out of order or by many processes may need timestamp parsing before ordering is meaningful.
Confirm the start position and poll interval keys, along with their defaults, in the filelog receiver README before you choose a value for production.
Parsing operators turn raw text lines into structured log records. A regular expression operator is precise and easy to test, but it is brittle when a format changes and can be slow on long lines with many alternations. A JSON operator is cheap and exact when applications already write JSON, but it only works on lines that are complete JSON objects. The transform processor, applied after parsing, handles nested data, field renames, and conditional updates that a single parser cannot express. Many pipelines use a small parser first and push nested cleanup into a later stage.
- Regex operator: Works for any text layout, but each pattern is a maintenance point.
- JSON operator: Fast and exact for structured applications, with no help for mixed output.
- Transform for nested data: Handles nested attributes and field updates after parsing, which keeps parsers simple.
- Timestamp parsing: Get it right at this stage, since wrong timestamps are hard to fix later.
- Failure handling: Decide whether unparsed lines are kept as raw bodies or dropped, because silent drops hide format drift.
Confirm operator names, their options, and the transform processor syntax in the filelog receiver README and the OTTL documentation for your Collector version. The transform processor is covered in the OTTL sibling topic.
Stack traces, multi-line SQL statements, and wrapped JSON produce one logical event across several physical lines. The receiver can join these lines with a recognizer that decides where each event starts. The two common approaches are matching a start pattern, such as a timestamp at the beginning of a line, or matching a continuation pattern, such as lines that begin with whitespace. The start-pattern approach is usually more reliable because it does not depend on indentation. Getting this wrong either splits one exception across many records or merges unrelated lines into one event, which distorts search and alerting.
- Start-of-event pattern: Preferred when every event begins with a predictable marker such as a timestamp.
- Continuation pattern: Useful for indented stack traces, but fragile when formatting changes.
- Maximum event size: A limit protects against a runaway event that never ends.
- Timeouts at file end: The last event may wait for a following line, so check how the receiver flushes it.
- Test with real samples: Use captured logs from the application, including its worst-case exceptions.
Confirm the multiline option names and their flushing behavior in the filelog receiver README for your version. Check that a sample file produces the event count you expect before applying the configuration to production hosts.
Checkpoints record how far the receiver has read in each file, so a restart resumes instead of re-reading or skipping. Without storage, offsets live only in memory, and every Collector restart forces a decision about start position that can duplicate or lose lines. A storage extension, such as file-based storage on a persistent volume, keeps those offsets across restarts. The trade-off is that the storage location becomes a stateful dependency: it needs disk space, correct permissions, and a plan for what happens when a file is replaced or truncated. In containers, the storage path must sit on a volume that survives pod recreation.
- No storage: Simplest setup, but restarts can duplicate or drop lines.
- File-based storage: Survives process restarts on the same host, and requires a writable, durable path.
- Volume choice: Ephemeral container storage loses checkpoints when the pod is replaced.
- Rotated or replaced files: Checkpoints keyed to a file identity may not match a new file with the same path.
- Disk pressure: Checkpoint writes add I/O on busy hosts, so measure them during testing.
Confirm the storage extension name, its configuration keys, and how the receiver references it in the filelog receiver README and the Collector configuration documentation for your version before you rely on it for recovery.
How file logs move from disk to the back end
The path starts with log files on the host, which the filelog receiver tails and parses with its operators. Records then pass through the transform processor, batching and the memory limiter before the exporter sends them to the back end. The file_storage extension keeps offset checkpoints on the host so reading can resume after a restart. Check that the checkpoint directory is writable and persists across restarts, and that the back end sits outside the host trust boundary.
Log lines flow from host files through the Collector to the back end, with offsets checkpointed on the host.
Setting up file log collection in a staged rollout
This sequence moves log file collection from a single test host to every host group while proving, at each stage, that every line is read once, parsed correctly and kept through a Collector restart. The old shipper stays in place until the new pipeline has matched it on every group.
Inventory log paths and formats
The platform owner and application teams list every log file to collect, with its path pattern, rotation scheme, encoding, timestamp format and whether entries span several lines, such as stack traces. Record which files the current shipper reads, because that list is the baseline for later comparison. The step is done when each file has an owner, a sample of recent lines and a written parsing expectation.
Run the Collector with the debug exporter
On one non-production host, install a Collector build that includes the filelog receiver and run it with a configuration that reads a single representative file and writes the results to the debug exporter. Confirm the file path resolves, the process has read permission and the Collector starts without configuration errors. The step is done when the debug output shows records with the expected body text and no unexpected duplicates or gaps against the source file.
Add parsing and multiline rules
Add a parser operator that turns each raw line into structured fields, and add a multiline configuration for files whose events span several lines. Test the regular expressions against the sample lines from step one, including the malformed lines, because a single bad pattern can merge or split events. The step is done when a sample of parsed records has the expected timestamp, severity and fields, and when the count of records matches the count of logical events in the source file.
Enable file_storage checkpoints
Configure the file_storage extension with a local directory the Collector user can write to, then reference it from the filelog receiver so read offsets are saved. Confirm the directory is on persistent storage and is not wiped when the container or service restarts. The step is done when the storage directory holds offset data after a short run and the receiver reports that it is using the storage extension.
Confirm offsets survive a restart
Stop the Collector while the test file is still receiving lines, write a known number of new lines, then start the Collector again. Count the records the debug exporter emits and compare them with the lines written to the file, checking for no duplicates from the restart window and no missing lines. The step is done when the counts match across at least one restart and across a rotation of the test file, which is the case most likely to lose data.
Roll out by host group
Deploy the same configuration to one host group at a time, starting with the least critical group, and repeat the line count check on a sample host from each group. Run the new pipeline and the existing shipper side by side on each group until the record counts agree over a period you define with the application owners. The step is done when every group has a signed-off comparison and the monitoring for the Collector itself shows no sustained errors.
Retire the old shipper
Once every group has passed its comparison, stop and remove the previous log shipper, its configuration and its offset files, and record the change in the runbook with the final configuration version. Keep the old configuration in version control for rollback. The step is done when the old shipper is no longer running on any host, the new pipeline is the only source for those log files and the team has confirmed the runbook reflects the live setup.
How multiline stack traces and parsed fields behave in the pipeline
A Java stack trace is not one log record in the file, it is many lines, and the filelog receiver only knows where a record starts if you tell it. The start-of-entry pattern (set with multiline and line_start_pattern on the file input) is the decision that determines whether each exception arrives as one record or as dozens. Pick a pattern that matches the timestamp or level prefix your application writes at the beginning of every new entry, such as the ISO timestamp that opens a normal log line. Lines that do not match the pattern are appended to the previous entry, which is why a continuation line like at com.example.Service.call(Service.java:42) belongs to the exception above it. If the pattern is too broad, stray lines that happen to contain a date become new records and the stack trace splinters. If it is too narrow, or the application changes its timestamp format after an upgrade, consecutive entries merge into one oversized record. Confirm the exact timestamp layout with the application team and check the filelog receiver README for the current multiline options before you commit to a pattern.
Parsed fields are where the pipeline becomes hard to reason about. Operators such as regex parsing write extracted values into the log record, and those values become attributes that downstream processors can read, rename, or drop. The transform processor can then reshape them with OTTL statements, for example moving a parsed level value into the severity field or removing a field that holds personal data. The order matters: a multiline record that was merged wrongly will fail its regex, so the fields you expected will simply be missing, and a downstream rule that assumes they exist will quietly do nothing. Before production, run the configuration against a file of representative samples. Include normal single-line entries, multi-line Java traces with nested causes, and any non-Java output the same file receives. Check the record count against the number of log events you expect, inspect the body and attributes of a sample of exceptions, and confirm that no parse errors appear for lines you care about. Keep the sample file under version control so the same test runs again after every change.
Security risks in file log collection to address first
Log files are written by applications and operating systems, often without thought for who will read them later. A filelog pipeline copies that content, its permissions and its read positions into a new place, so each step needs a control. The cards below cover the risks that appear first in most file log collection projects.
Credentials and personal data in logs
Applications often write tokens, passwords, session identifiers and personal data into log lines, and the filelog receiver will read and forward all of it. Use the redaction processor to remove known sensitive attributes before export, and sample real log lines from each source to find what it contains. Check the redacted output in the back end, not only the Collector configuration. Redaction rules need updating whenever an application changes its logging.
Collector security practicesLeast-privilege file access for the Collector
The Collector process needs read access only to the log paths it tails. Running it as root or as a user that can read other services' secrets widens the damage of any compromise. Create a dedicated service account, grant read access through group membership on the specific log directories, and confirm that the account cannot read application configuration or key material. Review permissions again after log rotation changes file ownership.
Protecting checkpoint storage
When file_storage persists read offsets, the checkpoint directory records which files were read and where. Anyone who can alter those files can cause lost or duplicated log lines, and the directory may reveal file names that point to sensitive activity. Give it a directory owned by the Collector user with restricted permissions, keep it off shared volumes, and back it up with the rest of the Collector state so restarts resume cleanly.
Securing exporter endpoints and authenticators
Receivers and exporters that carry logs off the host need authentication and encryption. Server components bind to localhost by default in recent Collector versions, so opening a listener is a deliberate change that should be reviewed. Use authenticator extensions such as OIDC on receivers and the oauth2client extension on exporters where your design calls for them, and confirm TLS settings on every outbound connection.
- Localhost default since
- v0.110.0
Storing Collector configuration securely
Filelog configurations contain file paths, endpoint addresses and sometimes credentials for exporters. Keep the configuration in version control with restricted access, inject secrets at runtime from your secrets manager rather than writing them into files, and limit who can change the rollout. Treat a change to a parsing or redaction rule as a security change that gets reviewed, since it determines what leaves the host.
Building only the needed components
A filelog pipeline usually needs a small set of receivers, processors and exporters. Build the Collector with the Collector Builder so the binary includes only those components, which reduces the code that can be attacked and the number of components to patch. Pin the component versions in the builder manifest, and check the stability level of each component you include, since the README of each component documents it.
Collector security practicesQuestions teams ask before collecting logs with the filelog receiver
What drives the effort of replacing a log shipper?
The effort depends mainly on how many log sources you have, how many distinct formats they use, and how much parsing each format needs. Replacing a shipper means mapping every existing parsing rule, field name and routing decision onto receiver operators and processor logic, then comparing the output against what the old shipper produced. A few uniform application logs usually take far less work than dozens of hosts with legacy formats and multiline stack traces. Ask for a written inventory of sources, formats and the dashboards and alerts that depend on current field names, because those three items usually shape the quote. Also list the current shipper's features, such as buffering and file rotation handling, since each one needs an equivalent or a documented decision to drop it.
Can our team collect log files without outside help?
Many in-house teams can do it if they have someone comfortable with Collector configuration in YAML and access to the hosts and the back end. The filelog receiver is one component in a pipeline, so the skills overlap with general platform work. Outside help is most often needed for parsing unusual or legacy formats, testing against production-level log volume, and planning a cutover that keeps the old and new shippers running side by side until the data matches. A practical split is to keep design ownership and the cutover checklist in-house and bring in a partner for the parts that are new to the team. DeployOpen plans, implements and supports self-hosted platforms inside your own infrastructure, and the scope is agreed in writing before work starts.
How long does a filelog rollout take, and what sets it?
The duration depends on the number of hosts, the number of distinct log formats, the number of multiline cases, and whether the back end is ready to receive the data. Hosts are often the simplest part once a configuration template is tested, because the same pattern can be deployed through your existing configuration management. Formats and multiline cases usually take the most time, since each one needs samples, parsing rules and checks that fields land correctly. Back-end readiness covers index or schema design, retention settings and access for the teams who will query the data. No duration is given here because it depends on those inputs. Ask for a timeline built from your source inventory, with a phase for each format group and a cutover window agreed with your operations team.
What does the work need from our team to start?
Plan to provide log samples from each source, including rotated files and at least one example of every multiline pattern. You also need access to the hosts or the configuration management that deploys to them, a test environment where the Collector can run against copies of your logs, and a target back end with credentials for the pipeline. Change windows matter because a shipper replacement touches every host that runs it, and you will want a tested rollback path. Name an owner who can approve field naming and retention decisions, since delays in those decisions slow the whole project. Redact personal and regulated data from samples before they leave your network, following your own data protection rules.
- Log samples from each source, including rotated files
- Host or configuration management access
- A test environment and a target back end with credentials
- Approved change windows and a named decision owner
What happens to log files when the Collector restarts?
Log lines written while the Collector is down are read again or skipped, depending on how the receiver tracks its position in each file, so checkpoint configuration decides the outcome. The filelog receiver records how far it has read each file. To keep that record across restarts, you need to configure a storage extension so the offsets are persisted to disk. Without persistent storage, a restart can lose the position and cause duplicates or gaps. Confirm the exact behavior for your Collector version in the filelog receiver README, then test it directly: stop the Collector during a log burst, restart it, and compare counts at the source and at the back end. Also confirm how rotation and truncation are handled, since those events affect offsets as much as restarts do.
Is the filelog receiver production-ready while it is beta?
The filelog receiver is listed as beta for logs in its README, which means its behavior and configuration can still change between releases. Many teams run beta components in production after testing, but the decision is a risk you carry, so document it. Pin the Collector version, read the release notes before each upgrade, and check each component's stability level, because OpenTelemetry notes that core components have mixed stability. Run the new pipeline in parallel with the existing shipper for a period, compare outputs, and load-test the volumes you actually produce. Monitoring the Collector itself, including refused and dropped data, gives early warning when something changes. Confirm the current status in the filelog receiver README before you commit.
How are multiline logs such as stack traces handled?
Multiline logs, such as Java stack traces or entries that span several lines, need a rule that decides where one record ends and the next begins. The filelog receiver supports multiline handling, usually by matching the first line of a new entry with a pattern. Confirm the available options and their syntax in the filelog receiver README for your version. Choose patterns from actual samples rather than from documentation alone, because a stack trace that starts with a blank line behaves differently from one that starts with a timestamp. Test edge cases such as entries cut off at file rotation and output interleaved from multiple threads. Structured content inside a record can then be parsed with the transform processor, which can parse nested data and add, remove or update values. Validate each pattern against a sample set before rollout.
Limits to confirm in your environment before rollout
The filelog receiver is a capable tool, but its limits depend on your log formats, rotation habits and host sizing. The cards below list the checks that connect the component's maturity to your own files, bursts and parsing load, so you can test them before logs leave the host.
Beta status of the logs path
The filelog receiver is beta for logs, so its configuration options and behavior can still change between Collector releases. Read the component README for the stability level of each part you use, and pin the Collector version in your build. Plan a regression test of your parsing and checkpointing settings before every upgrade, and keep the previous build available for rollback.
Filelog READMERotation and truncation behavior
Logrotate can rename, copy and truncate files, and each pattern affects whether the receiver keeps its place. Test copytruncate, rename-and-create and compressed archives on a staging host with the same logrotate settings as production. Confirm that no lines are lost or duplicated across a rotation, and that old files are excluded from the include glob.
Container and Kubernetes log paths
Container log files on Kubernetes nodes follow their own naming and rotation rules, and they are covered separately in the Kubernetes guidance. Do not assume that a host include pattern will match container runtime paths. Confirm where your runtime writes logs and which metadata you need before you reuse this configuration on cluster nodes.
Throughput and memory under bursts
A sudden spike in log volume can fill batches and queues faster than the exporter drains them. Measure peak lines per second on your busiest hosts and watch the memory limiter and refused-data signals during a load test. Size batching and memory limits with the sizing guidance before you enable the pipeline on production hosts.
Cost of heavy regular expressions
Complex regular expressions and multiline patterns run on every line, so a poorly bounded pattern can slow the pipeline and hold back checkpoint updates. Benchmark each parser against a sample of real lines, including malformed ones. Prefer anchored, specific patterns, and move heavy reshaping to a later stage only after you have measured its cost.
Windows and journald sources
The filelog receiver reads plain files, so it does not cover the Windows event log or the systemd journal. Those sources use their own receivers, with their own dependencies and permissions. Inventory every log source on each host type early, so you can plan one receiver per source type rather than forcing all logs through file tailing.
What replacing an existing log shipper actually changes
Replacing a log shipper moves four jobs into the Collector: tailing files, parsing lines into structured records, enriching them with resource attributes, and routing them to the right destination. The filelog receiver takes over tailing and parsing through its operators, and the transform processor (using OTTL) covers enrichment and field changes. Routing is handled by pipeline layout and exporters. Before you change anything, inventory what your current shipper does in each of these four areas, including small details such as dropping debug lines, renaming fields, or sending certain hosts to a second index. Each one needs an equivalent in the Collector configuration, or a documented decision to stop doing it.
Several things stay where they are. Your log back end still owns storage, indexing, retention, search, dashboards and alerting, and OpenTelemetry supplies none of these. The OpenTelemetry project describes itself as a framework and toolkit, not a back end, so the search and alert rules you run today will keep working only if the new records arrive with the field names and types they expect. Confirm that retention settings, access controls and alert queries do not depend on the old shipper's naming, and plan a mapping for any field that changes.
Run the old and new shippers in parallel on the same hosts for a fixed comparison window, sending to separate indexes or a test tenant. Compare record counts per file, per host and per severity, and check for gaps and duplicates after restarts and log rotations. Differences almost always come from parsing, multiline grouping or offset handling, so sample specific lines rather than trusting totals alone. Ask your team to agree in writing on an acceptable tolerance and on which discrepancies block cutover. Keep the old shipper's configuration available until the new path has run through at least one rotation and one restart cycle without unexplained differences.
How DeployOpen scopes and delivers file log collection
DeployOpen scopes file log collection in writing before any Collector configuration is changed. The scope names the hosts and applications in play, the log paths and rotation behavior to be covered, the parsing targets (for example, which lines must become structured attributes and which can remain raw bodies), and the destination back end. It also states what is out of scope, such as shipping logs from hosts that are not yet covered by an owner or changing the existing shipper's retention settings. Deliverables and acceptance checks are agreed at the same time, so the client knows what it will receive and how it will be verified.
Delivery starts with an inventory of sources and formats. DeployOpen works with your teams to list each log file, its writer, its timestamp format, whether it wraps stack traces or other multiline events, how it rotates, and whether it contains fields that must be redacted before export. From that inventory, the team builds the filelog receiver configuration, its parsing operators, and the file_storage checkpointing setup, then tests them in a non-production environment inside your own cloud accounts, data centers or air-gapped network. Tests include rotation, restarts and out-of-order writes, and the results are documented so your platform and security teams can review them.
After acceptance, DeployOpen supports the staged rollout to production hosts and hands over runbooks for changing parsers when application log formats change. Upgrades to the Collector and its components are a recurring cost that you can plan for through a retainer, which covers release tracking, testing against your configuration and rollout support. Ask any partner, including DeployOpen, to confirm in the written scope how long support runs, what response is covered and who owns the configuration after handover.

