diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index 1c05d4606..28f512c68 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -547,10 +547,19 @@ func TestValidateFile(t *testing.T) { "deprecated_integration_policy": {}, "deprecated_integration_stream_var": {}, "good_migrate_from": {}, + "good_var_migrate_from": {}, "bad_migrate_from": { "manifest.yml", []string{`field policy_templates.0.inputs.0: Additional property migrate_from is not allowed`}, }, + "bad_var_migrate_from": { + "data_stream/logs/manifest.yml", + []string{`field streams.0.vars.1: Additional property migrate_from is not allowed`}, + }, + "bad_var_migrate_from_scope": { + "data_stream/logs/manifest.yml", + []string{`field streams.0.vars.1.migrate_from.scope: streams.0.vars.1.migrate_from.scope must be one of the following: "input", "stream"`}, + }, "bad_deprecation_description": { "manifest.yml", []string{"field deprecated.description: Invalid type. Expected: string, given: null"}, diff --git a/spec/changelog.yml b/spec/changelog.yml index 679585b08..dd33dec24 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -11,6 +11,9 @@ - description: Add optional `release` field to agentless deployment mode to explicitly declare its release stage. type: enhancement link: https://github.com/elastic/package-spec/pull/1130 + - description: Add `migrate_from` object to variable definitions to declare that a variable moved between input-level and stream-level scope within the same input type. + type: enhancement + link: https://github.com/elastic/package-spec/pull/1162 - version: 3.6.2 changes: - description: Add support for ML modules in content packages. diff --git a/spec/integration/data_stream/manifest.spec.yml b/spec/integration/data_stream/manifest.spec.yml index 640ca5cf6..810e00a7a 100644 --- a/spec/integration/data_stream/manifest.spec.yml +++ b/spec/integration/data_stream/manifest.spec.yml @@ -173,6 +173,44 @@ spec: $ref: "#/definitions/input_variable_value" deprecated: $ref: "../../integration/manifest.spec.yml#/definitions/deprecated" + migrate_from: + description: > + Declares that this variable was previously named differently or + defined at a different scope. Fleet carries the old value over + when upgrading a policy. At least one of `name` or `scope` must + be set. Both may be set together when the variable was both + renamed and moved between scopes. + type: object + additionalProperties: false + properties: + name: + description: > + Previous name of the variable. Use when the variable was + renamed between package versions. Combine with `scope` if + the variable was also moved to a different scope. + type: string + scope: + description: > + The scope where this variable previously lived. Use when the + variable moved between input-level and stream-level within + the same input type. + type: string + enum: + - input + - stream + stream: + description: > + The source stream to pull the old value from. May be written + as the data stream folder name (e.g. `logs`) or the + fully-qualified dataset (e.g. `mypackage.logs`); both forms + are accepted. Required when `scope` is "stream" and the + source input has more than one stream. May be omitted when + the source input has exactly one stream. Has no effect when + `scope` is "input". + type: string + anyOf: + - required: [name] + - required: [scope] allOf: - if: properties: @@ -710,6 +748,11 @@ spec: - title # JSON patches for newer versions should be placed on top versions: + - before: 3.7.0 + patch: + # Variable-level scope migration. + - op: remove + path: /definitions/vars/items/properties/migrate_from - before: 3.6.0 patch: - op: add diff --git a/test/packages/bad_var_migrate_from/LICENSE.txt b/test/packages/bad_var_migrate_from/LICENSE.txt new file mode 100644 index 000000000..809108b85 --- /dev/null +++ b/test/packages/bad_var_migrate_from/LICENSE.txt @@ -0,0 +1,93 @@ +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. diff --git a/test/packages/bad_var_migrate_from/_dev/build/docs/README.md b/test/packages/bad_var_migrate_from/_dev/build/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/bad_var_migrate_from/_dev/build/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/bad_var_migrate_from/changelog.yml b/test/packages/bad_var_migrate_from/changelog.yml new file mode 100644 index 000000000..bb0320a52 --- /dev/null +++ b/test/packages/bad_var_migrate_from/changelog.yml @@ -0,0 +1,6 @@ +# newer versions go on top +- version: "0.0.1" + changes: + - description: Initial draft of the package + type: enhancement + link: https://github.com/elastic/integrations/pull/1 # FIXME Replace with the real PR link diff --git a/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs b/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs new file mode 100644 index 000000000..3bf54f25b --- /dev/null +++ b/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs @@ -0,0 +1,4 @@ +paths: +{{#each paths as |path|}} + - {{path}} +{{/each}} diff --git a/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs b/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/test/packages/bad_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs @@ -0,0 +1 @@ +--- diff --git a/test/packages/bad_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml b/test/packages/bad_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml new file mode 100644 index 000000000..505d88bea --- /dev/null +++ b/test/packages/bad_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml @@ -0,0 +1,18 @@ +--- +description: Pipeline for processing sample logs +processors: + - set: + tag: set_dataset + field: data_stream.dataset + value: bad_var_migrate_from.logs +on_failure: + - set: + field: event.kind + value: pipeline_error + - set: + field: error.message + value: >- + Processor '{{{ _ingest.on_failure_processor_type }}}' + with tag '{{{ _ingest.on_failure_processor_tag }}}' + in pipeline '{{{ _ingest.pipeline }}}' + failed with message '{{{ _ingest.on_failure_message }}}' diff --git a/test/packages/bad_var_migrate_from/data_stream/logs/fields/base-fields.yml b/test/packages/bad_var_migrate_from/data_stream/logs/fields/base-fields.yml new file mode 100644 index 000000000..7c798f453 --- /dev/null +++ b/test/packages/bad_var_migrate_from/data_stream/logs/fields/base-fields.yml @@ -0,0 +1,12 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: '@timestamp' + type: date + description: Event timestamp. diff --git a/test/packages/bad_var_migrate_from/data_stream/logs/manifest.yml b/test/packages/bad_var_migrate_from/data_stream/logs/manifest.yml new file mode 100644 index 000000000..e9554b8d0 --- /dev/null +++ b/test/packages/bad_var_migrate_from/data_stream/logs/manifest.yml @@ -0,0 +1,22 @@ +title: "Sample Logs" +type: logs +streams: + - input: filestream + title: "Collect logs via filestream" + description: "Collect logs using the filestream input" + template_path: filestream.yml.hbs + vars: + - name: paths + type: text + title: "Paths" + multi: true + required: true + show_user: true + default: + - /var/log/*.log + - name: api_url + type: url + title: "API URL" + description: "URL that previously lived at input-level." + migrate_from: + scope: input diff --git a/test/packages/bad_var_migrate_from/docs/README.md b/test/packages/bad_var_migrate_from/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/bad_var_migrate_from/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/bad_var_migrate_from/img/sample-logo.svg b/test/packages/bad_var_migrate_from/img/sample-logo.svg new file mode 100644 index 000000000..6268dd88f --- /dev/null +++ b/test/packages/bad_var_migrate_from/img/sample-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/packages/bad_var_migrate_from/img/sample-screenshot.png b/test/packages/bad_var_migrate_from/img/sample-screenshot.png new file mode 100644 index 000000000..d7a56a3ec Binary files /dev/null and b/test/packages/bad_var_migrate_from/img/sample-screenshot.png differ diff --git a/test/packages/bad_var_migrate_from/manifest.yml b/test/packages/bad_var_migrate_from/manifest.yml new file mode 100644 index 000000000..7ef6f4c9d --- /dev/null +++ b/test/packages/bad_var_migrate_from/manifest.yml @@ -0,0 +1,38 @@ +format_version: 3.6.0 +name: bad_var_migrate_from +title: "Bad Var Migrate From" +version: 0.0.1 +source: + license: "Elastic-2.0" +description: "Integration package using var-level migrate_from with a format_version that does not support it." +type: integration +categories: + - custom +conditions: + kibana: + version: "^9.2.3" + agent: + version: "^8.9.0" + elastic: + subscription: "basic" +screenshots: + - src: /img/sample-screenshot.png + title: Sample screenshot + size: 600x600 + type: image/png +icons: + - src: /img/sample-logo.svg + title: Sample logo + size: 32x32 + type: image/svg+xml +policy_templates: + - name: sample + title: Sample logs + description: Collect sample logs + inputs: + - type: filestream + title: Collect sample logs from instances + description: Collecting sample logs via filestream +owner: + github: elastic/integrations + type: elastic diff --git a/test/packages/bad_var_migrate_from/sample_event.json b/test/packages/bad_var_migrate_from/sample_event.json new file mode 100644 index 000000000..2cf93e50b --- /dev/null +++ b/test/packages/bad_var_migrate_from/sample_event.json @@ -0,0 +1,3 @@ +{ + "description": "This is an example sample-event for New Package. Replace it with a real sample event. Hint: If system tests exist, running `elastic-package test system --generate` will generate this file." +} diff --git a/test/packages/bad_var_migrate_from_scope/LICENSE.txt b/test/packages/bad_var_migrate_from_scope/LICENSE.txt new file mode 100644 index 000000000..809108b85 --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/LICENSE.txt @@ -0,0 +1,93 @@ +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. diff --git a/test/packages/bad_var_migrate_from_scope/_dev/build/docs/README.md b/test/packages/bad_var_migrate_from_scope/_dev/build/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/_dev/build/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/bad_var_migrate_from_scope/changelog.yml b/test/packages/bad_var_migrate_from_scope/changelog.yml new file mode 100644 index 000000000..bb0320a52 --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/changelog.yml @@ -0,0 +1,6 @@ +# newer versions go on top +- version: "0.0.1" + changes: + - description: Initial draft of the package + type: enhancement + link: https://github.com/elastic/integrations/pull/1 # FIXME Replace with the real PR link diff --git a/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/filestream.yml.hbs b/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/filestream.yml.hbs new file mode 100644 index 000000000..3bf54f25b --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/filestream.yml.hbs @@ -0,0 +1,4 @@ +paths: +{{#each paths as |path|}} + - {{path}} +{{/each}} diff --git a/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/stream.yml.hbs b/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/stream.yml.hbs new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/data_stream/logs/agent/stream/stream.yml.hbs @@ -0,0 +1 @@ +--- diff --git a/test/packages/bad_var_migrate_from_scope/data_stream/logs/elasticsearch/ingest_pipeline/default.yml b/test/packages/bad_var_migrate_from_scope/data_stream/logs/elasticsearch/ingest_pipeline/default.yml new file mode 100644 index 000000000..bfd97417a --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/data_stream/logs/elasticsearch/ingest_pipeline/default.yml @@ -0,0 +1,18 @@ +--- +description: Pipeline for processing sample logs +processors: + - set: + tag: set_dataset + field: data_stream.dataset + value: bad_var_migrate_from_scope.logs +on_failure: + - set: + field: event.kind + value: pipeline_error + - set: + field: error.message + value: >- + Processor '{{{ _ingest.on_failure_processor_type }}}' + with tag '{{{ _ingest.on_failure_processor_tag }}}' + in pipeline '{{{ _ingest.pipeline }}}' + failed with message '{{{ _ingest.on_failure_message }}}' diff --git a/test/packages/bad_var_migrate_from_scope/data_stream/logs/fields/base-fields.yml b/test/packages/bad_var_migrate_from_scope/data_stream/logs/fields/base-fields.yml new file mode 100644 index 000000000..7c798f453 --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/data_stream/logs/fields/base-fields.yml @@ -0,0 +1,12 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: '@timestamp' + type: date + description: Event timestamp. diff --git a/test/packages/bad_var_migrate_from_scope/data_stream/logs/manifest.yml b/test/packages/bad_var_migrate_from_scope/data_stream/logs/manifest.yml new file mode 100644 index 000000000..9a11ab810 --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/data_stream/logs/manifest.yml @@ -0,0 +1,22 @@ +title: "Sample Logs" +type: logs +streams: + - input: filestream + title: "Collect logs via filestream" + description: "Collect logs using the filestream input" + template_path: filestream.yml.hbs + vars: + - name: paths + type: text + title: "Paths" + multi: true + required: true + show_user: true + default: + - /var/log/*.log + - name: api_url + type: url + title: "API URL" + description: "URL with an invalid migrate_from scope." + migrate_from: + scope: global diff --git a/test/packages/bad_var_migrate_from_scope/docs/README.md b/test/packages/bad_var_migrate_from_scope/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/bad_var_migrate_from_scope/img/sample-logo.svg b/test/packages/bad_var_migrate_from_scope/img/sample-logo.svg new file mode 100644 index 000000000..6268dd88f --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/img/sample-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/packages/bad_var_migrate_from_scope/img/sample-screenshot.png b/test/packages/bad_var_migrate_from_scope/img/sample-screenshot.png new file mode 100644 index 000000000..d7a56a3ec Binary files /dev/null and b/test/packages/bad_var_migrate_from_scope/img/sample-screenshot.png differ diff --git a/test/packages/bad_var_migrate_from_scope/manifest.yml b/test/packages/bad_var_migrate_from_scope/manifest.yml new file mode 100644 index 000000000..927be9753 --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/manifest.yml @@ -0,0 +1,38 @@ +format_version: 3.7.0 +name: bad_var_migrate_from_scope +title: "Bad Var Migrate From Scope" +version: 0.0.1 +source: + license: "Elastic-2.0" +description: "Integration package using var-level migrate_from with an invalid scope value." +type: integration +categories: + - custom +conditions: + kibana: + version: "^9.2.3" + agent: + version: "^8.9.0" + elastic: + subscription: "basic" +screenshots: + - src: /img/sample-screenshot.png + title: Sample screenshot + size: 600x600 + type: image/png +icons: + - src: /img/sample-logo.svg + title: Sample logo + size: 32x32 + type: image/svg+xml +policy_templates: + - name: sample + title: Sample logs + description: Collect sample logs + inputs: + - type: filestream + title: Collect sample logs from instances + description: Collecting sample logs via filestream +owner: + github: elastic/integrations + type: elastic diff --git a/test/packages/bad_var_migrate_from_scope/sample_event.json b/test/packages/bad_var_migrate_from_scope/sample_event.json new file mode 100644 index 000000000..2cf93e50b --- /dev/null +++ b/test/packages/bad_var_migrate_from_scope/sample_event.json @@ -0,0 +1,3 @@ +{ + "description": "This is an example sample-event for New Package. Replace it with a real sample event. Hint: If system tests exist, running `elastic-package test system --generate` will generate this file." +} diff --git a/test/packages/good_var_migrate_from/LICENSE.txt b/test/packages/good_var_migrate_from/LICENSE.txt new file mode 100644 index 000000000..809108b85 --- /dev/null +++ b/test/packages/good_var_migrate_from/LICENSE.txt @@ -0,0 +1,93 @@ +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. diff --git a/test/packages/good_var_migrate_from/_dev/build/docs/README.md b/test/packages/good_var_migrate_from/_dev/build/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/good_var_migrate_from/_dev/build/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/good_var_migrate_from/changelog.yml b/test/packages/good_var_migrate_from/changelog.yml new file mode 100644 index 000000000..bb0320a52 --- /dev/null +++ b/test/packages/good_var_migrate_from/changelog.yml @@ -0,0 +1,6 @@ +# newer versions go on top +- version: "0.0.1" + changes: + - description: Initial draft of the package + type: enhancement + link: https://github.com/elastic/integrations/pull/1 # FIXME Replace with the real PR link diff --git a/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs b/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs new file mode 100644 index 000000000..3bf54f25b --- /dev/null +++ b/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/filestream.yml.hbs @@ -0,0 +1,4 @@ +paths: +{{#each paths as |path|}} + - {{path}} +{{/each}} diff --git a/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs b/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/test/packages/good_var_migrate_from/data_stream/logs/agent/stream/stream.yml.hbs @@ -0,0 +1 @@ +--- diff --git a/test/packages/good_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml b/test/packages/good_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml new file mode 100644 index 000000000..bd6c8a6a6 --- /dev/null +++ b/test/packages/good_var_migrate_from/data_stream/logs/elasticsearch/ingest_pipeline/default.yml @@ -0,0 +1,18 @@ +--- +description: Pipeline for processing sample logs +processors: + - set: + tag: set_dataset + field: data_stream.dataset + value: good_var_migrate_from.logs +on_failure: + - set: + field: event.kind + value: pipeline_error + - set: + field: error.message + value: >- + Processor '{{{ _ingest.on_failure_processor_type }}}' + with tag '{{{ _ingest.on_failure_processor_tag }}}' + in pipeline '{{{ _ingest.pipeline }}}' + failed with message '{{{ _ingest.on_failure_message }}}' diff --git a/test/packages/good_var_migrate_from/data_stream/logs/fields/base-fields.yml b/test/packages/good_var_migrate_from/data_stream/logs/fields/base-fields.yml new file mode 100644 index 000000000..7c798f453 --- /dev/null +++ b/test/packages/good_var_migrate_from/data_stream/logs/fields/base-fields.yml @@ -0,0 +1,12 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: '@timestamp' + type: date + description: Event timestamp. diff --git a/test/packages/good_var_migrate_from/data_stream/logs/manifest.yml b/test/packages/good_var_migrate_from/data_stream/logs/manifest.yml new file mode 100644 index 000000000..e9554b8d0 --- /dev/null +++ b/test/packages/good_var_migrate_from/data_stream/logs/manifest.yml @@ -0,0 +1,22 @@ +title: "Sample Logs" +type: logs +streams: + - input: filestream + title: "Collect logs via filestream" + description: "Collect logs using the filestream input" + template_path: filestream.yml.hbs + vars: + - name: paths + type: text + title: "Paths" + multi: true + required: true + show_user: true + default: + - /var/log/*.log + - name: api_url + type: url + title: "API URL" + description: "URL that previously lived at input-level." + migrate_from: + scope: input diff --git a/test/packages/good_var_migrate_from/docs/README.md b/test/packages/good_var_migrate_from/docs/README.md new file mode 100644 index 000000000..f7e680d1b --- /dev/null +++ b/test/packages/good_var_migrate_from/docs/README.md @@ -0,0 +1,101 @@ +{{- generatedHeader }} +{{/* +This template can be used as a starting point for writing documentation for your new integration. For each section, fill in the details +described in the comments. + +Find more detailed documentation guidelines in https://www.elastic.co/docs/extend/integrations/documentation-guidelines +*/}} +# New Package Integration for Elastic + +## Overview +{{/* Complete this section with a short summary of what data this integration collects and what use cases it enables */}} +The New Package integration for Elastic enables collection of ... +This integration facilitates ... + +### Compatibility +{{/* Complete this section with information on what 3rd party software or hardware versions this integration is compatible with */}} +This integration is compatible with ... + +### How it works +{{/* Add a high level overview on how this integration works. For example, does it collect data from API calls or receiving data from a network or file.*/}} + +## What data does this integration collect? +{{/* Complete this section with information on what types of data the integration collects, and link to reference documentation if available */}} +The New Package integration collects log messages of the following types: +* ... + +### Supported use cases +{{/* Add details on the use cases that can be enabled by using this integration. Explain why a user would want to install and use this integration. */}} + +## What do I need to use this integration? +{{/* List any vendor-specific prerequisites needed before starting to install the integration. */}} + +## How do I deploy this integration? + +### Agent-based deployment + +Elastic Agent must be installed. For more details, check the Elastic Agent [installation instructions](docs-content://reference/fleet/install-elastic-agents.md). You can install only one Elastic Agent per host. + +Elastic Agent is required to stream data from the syslog or log file receiver and ship the data to Elastic, where the events will then be processed via the integration's ingest pipelines. + +{{/* If agentless is available for this integration, we'll want to include that here as well. +### Agentless deployment + +Agentless deployments are only supported in Elastic Serverless and Elastic Cloud environments. Agentless deployments provide a means to ingest data while avoiding the orchestration, management, and maintenance needs associated with standard ingest infrastructure. Using an agentless deployment makes manual agent deployment unnecessary, allowing you to focus on your data instead of the agent that collects it. + +For more information, refer to [Agentless integrations](https://www.elastic.co/guide/en/serverless/current/security-agentless-integrations.html) and [Agentless integrations FAQ](https://www.elastic.co/guide/en/serverless/current/agentless-integration-troubleshooting.html) +*/}} + +### Onboard / configure +{{/* List the steps that will need to be followed in order to completely set up a working integration. +For integrations that support multiple input types, be sure to add steps for all inputs. +*/}} + +### Validation +{{/* How can the user test whether the integration is working? Including example commands or test files if applicable */}} + +## Troubleshooting + +For help with Elastic ingest tools, check [Common problems](https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems). +{{/* +Add any vendor specific troubleshooting here. + +Are there common issues or “gotchas” for deploying this integration? If so, how can they be resolved? +If applicable, links to the third-party software’s troubleshooting documentation. +*/}} + +## Scaling + +For more information on architectures that can be used for scaling this integration, check the [Ingest Architectures](https://www.elastic.co/docs/manage-data/ingest/ingest-reference-architectures) documentation. +{{/* Add any vendor specific scaling information here */}} + +## Reference +{{/* Repeat for each data stream of the current type +### {Data stream name} + +The `{data stream name}` data stream provides events from {source} of the following types: {list types}. + +For each data_stream_name, include an optional summary of the datastream, the exported fields reference table and the sample event. + +The fields template function will be replaced by a generated list of all fields from the `fields/` directory of the data stream when building the integration. + +#### {data stream name} fields + +To include a generated list of fields from the `fields/` directory, uncomment and use: +{{ fields "data_stream_name" }} + +The event template function will be replaced by a sample event, taken from `sample_event.json`, when building this integration. + +To include a sample event from `sample_event.json`, uncomment and use: +{{ event "data_stream_name" }} + +*/}} + +### Inputs used +{{/* All inputs used by this package will be automatically listed here. */}} +{{ inputDocs }} + +### API usage +{{/* For integrations that use APIs to collect data, document all the APIs that are used, and link to relevant information */}} +These APIs are used with this integration: +* ... diff --git a/test/packages/good_var_migrate_from/img/sample-logo.svg b/test/packages/good_var_migrate_from/img/sample-logo.svg new file mode 100644 index 000000000..6268dd88f --- /dev/null +++ b/test/packages/good_var_migrate_from/img/sample-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/packages/good_var_migrate_from/img/sample-screenshot.png b/test/packages/good_var_migrate_from/img/sample-screenshot.png new file mode 100644 index 000000000..d7a56a3ec Binary files /dev/null and b/test/packages/good_var_migrate_from/img/sample-screenshot.png differ diff --git a/test/packages/good_var_migrate_from/manifest.yml b/test/packages/good_var_migrate_from/manifest.yml new file mode 100644 index 000000000..0d39efad3 --- /dev/null +++ b/test/packages/good_var_migrate_from/manifest.yml @@ -0,0 +1,47 @@ +format_version: 3.7.0 +name: good_var_migrate_from +title: "Good Var Migrate From" +version: 0.0.1 +source: + license: "Elastic-2.0" +description: "Integration package demonstrating migrate_from at the variable level for same-input-type scope migration." +type: integration +categories: + - custom +conditions: + kibana: + version: "^9.2.3" + agent: + version: "^8.9.0" + elastic: + subscription: "basic" +screenshots: + - src: /img/sample-screenshot.png + title: Sample screenshot + size: 600x600 + type: image/png +icons: + - src: /img/sample-logo.svg + title: Sample logo + size: 32x32 + type: image/svg+xml +policy_templates: + - name: sample + title: Sample logs + description: Collect sample logs + inputs: + - type: filestream + title: Collect sample logs from instances + description: Collecting sample logs via filestream + vars: + - name: shared_credential + type: password + title: Shared Credential + description: Credential that previously lived at stream-level. + secret: true + migrate_from: + scope: stream + stream: logs +owner: + github: elastic/integrations + type: elastic diff --git a/test/packages/good_var_migrate_from/sample_event.json b/test/packages/good_var_migrate_from/sample_event.json new file mode 100644 index 000000000..2cf93e50b --- /dev/null +++ b/test/packages/good_var_migrate_from/sample_event.json @@ -0,0 +1,3 @@ +{ + "description": "This is an example sample-event for New Package. Replace it with a real sample event. Hint: If system tests exist, running `elastic-package test system --generate` will generate this file." +}