Skip to content

Commit

Permalink
[receiver/filelog] Add multiline example (#31124)
Browse files Browse the repository at this point in the history
**Description:** 
This PR adds a more detailed example on how to use `multiline` setting
on `filelog` receiver. From my search I wasn't able to find any examples
around so I think it would be nice to have something for users that are
willing to quickly get on-boarded on log collection.

**Link to tracking Issue:** <Issue number if applicable> -

**Testing:** <Describe what testing was performed and which tests were
added.> -

**Documentation:** <Describe the documentation added.> .

Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark authored Feb 9, 2024
1 parent a932e91 commit fe92f80
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions receiver/filelogreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,31 @@ The above configuration will read logs from the "simple.log" file. Some examples
2023-06-20 12:50:00 DEBUG This is a test debug message
```

## Example - Multiline logs parsing

Receiver Configuration
```yaml
receivers:
filelog:
include:
- /var/log/example/multiline.log
multiline:
line_start_pattern: ^Exception
```
The above configuration will be able to parse multiline logs, splitting every time the `^Exception` pattern is met.

```
Exception in thread 1 "main" java.lang.NullPointerException
at com.example.myproject.Book.getTitle(Book.java:16)
at com.example.myproject.Author.getBookTitles(Author.java:25)
at com.example.myproject.Bootstrap.main(Bootstrap.java:14)
Exception in thread 2 "main" java.lang.NullPointerException
at com.example.myproject.Book.getTitle(Book.java:16)
at com.example.myproject.Author.getBookTitles(Author.java:25)
at com.example.myproject.Bootstrap.main(Bootstrap.java:44)
```
## Offset tracking
`storage` setting allows to define the proper storage extension to be used for storing file offsets.
Expand Down

0 comments on commit fe92f80

Please sign in to comment.