Skip to content

Commit

Permalink
Add flags to give permissions to write to any dataset and namespace (#…
Browse files Browse the repository at this point in the history
…157897)

Add flags to give permissions to reroute events from an input package to
other datastreams with the same type but different dataset and
namespace.

```
elasticsearch.dynamic_dataset: true
elasticsearch.dynamic_namespace: true,
```
  • Loading branch information
gsantoro authored May 22, 2023
1 parent 8c1624b commit b05ad20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions x-pack/plugins/fleet/common/services/policy_template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ describe('getNormalizedDataStreams', () => {
{
type: 'foo',
dataset: 'nginx.bar',
elasticsearch: {
dynamic_dataset: true,
dynamic_namespace: true,
},
title: expect.any(String),
release: 'ga',
package: 'nginx',
Expand Down
12 changes: 11 additions & 1 deletion x-pack/plugins/fleet/common/services/policy_template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const getNormalizedDataStreams = (
release: packageInfo.release || 'ga',
package: packageInfo.name,
path: packageInfo.name,
elasticsearch: packageInfo.elasticsearch,
elasticsearch: packageInfo.elasticsearch || {},
streams: [
{
input: policyTemplate.input,
Expand All @@ -100,6 +100,16 @@ export const getNormalizedDataStreams = (
],
};

if (packageInfo.type === 'input') {
dataStream.elasticsearch = {
...dataStream.elasticsearch,
...{
dynamic_dataset: true,
dynamic_namespace: true,
},
};
}

return dataStream;
});
};
Expand Down

0 comments on commit b05ad20

Please sign in to comment.