Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugging: test: simple tcp logger script #502

Merged
merged 1 commit into from
Dec 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions troubleshooting/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
- [Tail Input duplicates logs during rotation](#tail-input-duplicates-logs-because-of-rotation)
- [Fluent Bit Windows containers](#fluent-bit-windows-containers)
- [Networking issue with Windows containers when using async DNS resolution by plugins](#networking-issue-with-windows-containers-when-using-async-dns-resolution-by-plugins)
- [Testing](#testing)
- [Simple TCP Logger Script](#simple-tcp-logger-script)
- [FAQ]
- [AWS Go Plugins vs AWS Core C Plugins](#aws-go-plugins-vs-aws-core-c-plugins)
- [FireLens Tag and Match Pattern and generated config](#firelens-tag-and-match-pattern-and-generated-config)
Expand Down Expand Up @@ -593,6 +595,36 @@ To work around this issue, we suggest using the following option so that system
net.dns.mode LEGACY
```

### Testing

#### Simple TCP Logger Script

Note: In general, the AWS for Fluent Bit team recommends the [aws/firelens-datajet](https://github.com/aws/firelens-datajet) project to send test logs to Fluent Bit. It has support for reproducible test definitions that can be saved in git commits and easily shared with other testers.
Comment on lines +600 to +602
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay



If you want a real quick and easy way to test a [Fluent Bit TCP Input](https://docs.fluentbit.io/manual/pipeline/inputs/tcp), the following script can be used:

```
send_line_by_line() {
while IFS= read -r line; do
echo "$line" | nc 127.0.0.1 $2
sleep 1
done < "$1"
}

while true
do
send_line_by_line $1 $2
sleep 1
done
```

Save this as `tcp-logger.sh` and run `chmod +x tcp-logger.sh`. Then, create a file with logs that you want to send to the TCP input. The script can read a file line by line and send it to some TCP port. For example, if you have a log file called `example.log` and a Fluent Bit TCP input listening on port 5170, you would run:

```
./tcp-logger.sh example.log 5170
```

### FAQ

#### AWS Go Plugins vs AWS Core C Plugins
Expand Down