Skip to content

Commit

Permalink
Merge branch 'master' into port-copy-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrod1598 authored May 7, 2021
2 parents ca464d6 + dbd2f09 commit cdf9121
Show file tree
Hide file tree
Showing 10 changed files with 1,141 additions and 8 deletions.
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.13.22] - Unreleased

### Added
- Added copy operator

## [0.13.21] - 2021-05-07

### Changed
Expand All @@ -29,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added Azure Log Analytics Operator [PR 287](https://github.com/observIQ/stanza/pull/287)

## [0.13.19] - 2021-04-15

### Added
- Added float64 to Severity parser's supported types [PR 267](https://github.com/observIQ/stanza/issues/267)

Expand Down
2 changes: 2 additions & 0 deletions cmd/stanza/init_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import (
_ "github.com/observiq/stanza/operator/builtin/transformer/noop"
_ "github.com/observiq/stanza/operator/builtin/transformer/ratelimit"
_ "github.com/observiq/stanza/operator/builtin/transformer/recombine"
_ "github.com/observiq/stanza/operator/builtin/transformer/remove"
_ "github.com/observiq/stanza/operator/builtin/transformer/restructure"
_ "github.com/observiq/stanza/operator/builtin/transformer/retain"
_ "github.com/observiq/stanza/operator/builtin/transformer/router"

_ "github.com/observiq/stanza/operator/builtin/output/drop"
Expand Down
181 changes: 181 additions & 0 deletions docs/operators/remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
## `remove` operator

The `remove` operator removes a field from a record.

### Configuration Fields

| Field | Default | Description |
| --- | --- | --- |
| `id` | `remove` | A unique identifier for the operator |
| `output` | Next in pipeline | The connected operator(s) that will receive all outbound entries |
| `field` | required | The [field](/docs/types/field.md) to remove.
| `on_error` | `send` | The behavior of the operator if it encounters an error. See [on_error](/docs/types/on_error.md) |
| `if` | | An [expression](/docs/types/expression.md) that, when set, will be evaluated to determine whether this operator should be used for the given entry. This allows you to do easy conditional parsing without branching logic with routers. |

Example usage:

<hr>

Remove a value from the record
```yaml
- type: remove
field: key1
```
<table>
<tr><td> Input Entry </td> <td> Output Entry </td></tr>
<tr>
<td>
```json
{
"resource": { },
"labels": { },
"record": {
"key1": "val1",
}
}
```

</td>
<td>

```json
{
"resource": { },
"labels": { },
"record": { }
}
```

</td>
</tr>
</table>

<hr>

Remove an object from the record
```yaml
- type: remove
field: object
```
<table>
<tr><td> Input Entry </td> <td> Output Entry </td></tr>
<tr>
<td>
```json
{
"resource": { },
"labels": { },
"record": {
"object": {
"nestedkey": "nestedval"
},
"key": "val"
},
}
```

</td>
<td>

```json
{
"resource": { },
"labels": { },
"record": {
"key": "val"
}
}
```

</td>
</tr>
</table>

<hr>

Remove a value from labels
```yaml
- type: remove
field: $labels.otherkey
```
<table>
<tr><td> Input Entry </td> <td> Output Entry </td></tr>
<tr>
<td>
```json
{
"resource": { },
"labels": {
"otherkey": "val"
},
"record": {
"key": "val"
},
}
```

</td>
<td>

```json
{
"resource": { },
"labels": { },
"record": {
"key": "val"
}
}
```

</td>
</tr>
</table>

<hr>

Remove a value from resource

```yaml
- type: remove
field: $resource.otherkey
```
<table>
<tr><td> Input Entry </td> <td> Output Entry </td></tr>
<tr>
<td>
```json
{
"resource": {
"otherkey": "val"
},
"labels": { },
"record": {
"key": "val"
},
}
```

</td>
<td>

```json
{
"resource": { },
"labels": { },
"record": {
"key": "val"
}
}
```

</td>
</tr>
</table>
Loading

0 comments on commit cdf9121

Please sign in to comment.