Skip to content

Commit

Permalink
[4.5][csv-parser] Documents columnless mode (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
eldarnash committed Nov 27, 2023
1 parent 1f8ee3b commit e325f87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions content/chapter-parsers/csv-parser/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ weight: 400

{{< include-headless "chunk/topic-parser-csv-intro.md" >}}

{{< include-headless "chunk/csv-parser-columnless.md" >}}

## Example: Segmenting hostnames separated with a dash {#example-csv-parser}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ weight: 100

*Description:* Specifies the name of the columns to separate messages to. These names will be automatically available as macros. The values of these macros do not include the delimiters.


{{< include-headless "chunk/csv-parser-columnless.md" >}}

## delimiters() {#csv-parser-delimiter}

Expand Down
12 changes: 12 additions & 0 deletions content/headless/chunk/csv-parser-columnless.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Starting with {{% param "product.abbrev" %}} version 4.5, you can omit the `columns()` option, and extract the values into matches (`$1`, `$2`, `$3`, and so on), which are available as the anonymous list `$*`. For example:

```sh
@version: current

log {
source { tcp(port(2000) flags(no-parse)); };

parser { csv-parser(delimiters(',') dialect(escape-backslash)); };
destination { stdout(template("$ISODATE $*\n")); };
};
```

0 comments on commit e325f87

Please sign in to comment.