generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 629
adding file source page #11355
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
Merged
natebower
merged 5 commits into
opensearch-project:main
from
AntonEliatra:adding-file-source-page
Nov 4, 2025
Merged
adding file source page #11355
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39b13e3
adding file source page
AntonEliatra 6e20e7d
fixing valke errors
AntonEliatra c5914ad
Update file.md
AntonEliatra f4f44da
Apply suggestions from code review
kolchfa-aws fe13e8b
Update _data-prepper/pipelines/configuration/sources/file.md
natebower File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| layout: default | ||
| title: File | ||
| parent: Sources | ||
| grand_parent: Pipelines | ||
| nav_order: 24 | ||
| --- | ||
|
|
||
| # File source | ||
|
|
||
| The `file` plugin reads events from a local file once at pipeline startup. It is ideal for loading seed data, testing processors and sinks, or replaying a fixed dataset. This source **does not tail** a file for new lines after startup. | ||
|
|
||
| Option | Required | Type | Description | ||
| :--- | :--- | :--- | :--- | ||
| `path` | Yes | String | Absolute path to the input file inside the Data Prepper container, for example, `/usr/share/data-prepper/data/input.jsonl`. | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `format` | No | String | How to interpret the file content. Allowed values: `json`, `plain`. Use `json` when your file has one JSON object per line, or a JSON array. Use `plain` for raw text lines. Default is `plain`. | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `record_type` | No | String | The output record type produced by the source. Allowed values: `event`, `string`. Use `event` to produce structured events that downstream processors and the OpenSearch sink expect. Default is `string`. | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Example | ||
|
|
||
| The following examples demonstrate how different file types can be processed. | ||
|
|
||
| ### JSON file | ||
|
|
||
| The following example processes JSON file: | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| file-to-opensearch: | ||
| source: | ||
| file: | ||
| path: /usr/share/data-prepper/data/input.ndjson | ||
| format: json | ||
| record_type: event | ||
| sink: | ||
| - opensearch: | ||
| hosts: ["https://opensearch:9200"] | ||
| index: file-demo | ||
| username: admin | ||
| password: admin_pass | ||
| insecure: true | ||
| ``` | ||
| {% include copy.html %} | ||
|
|
||
| ### Plain text file | ||
|
|
||
| Raw text file can be processed using the following pipeline: | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| plain-file-to-opensearch: | ||
| source: | ||
| file: | ||
| path: /usr/share/data-prepper/data/app.log | ||
| format: plain | ||
| record_type: event | ||
| processor: | ||
| - grok: | ||
| match: | ||
| message: | ||
| - '%{TIMESTAMP_ISO8601:timestamp} \[%{LOGLEVEL:level}\] %{GREEDYDATA:msg}' | ||
| sink: | ||
| - opensearch: | ||
| hosts: ["https://opensearch:9200"] | ||
| index: plain-file-demo | ||
| username: admin | ||
| password: admin_pass | ||
| insecure: true | ||
| ``` | ||
| {% include copy.html %} | ||
|
|
||
| ### CSV file | ||
|
|
||
| You can process CSV file using the `csv` processor: | ||
natebower marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| csv-file-to-opensearch: | ||
| source: | ||
| file: | ||
| path: /usr/share/data-prepper/data/ingest.csv | ||
| format: plain | ||
| record_type: event | ||
| processor: | ||
| - csv: | ||
| column_names: ["time","level","message"] | ||
| sink: | ||
| - opensearch: | ||
| hosts: ["https://opensearch:9200"] | ||
| index: csv-demo | ||
| username: admin | ||
| password: admin_pass | ||
| insecure: true | ||
| ``` | ||
| {% include copy.html %} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.