Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Send fluent bit collected logs to Seq
Minhaz
Minhaz

Posted on • Originally published atgithub.com

Send fluent bit collected logs to Seq

Here I will setup fluent-bit and seq both with docker and push logs through fluent bit to to seq.
I will also show how to setup fluent bit and seq with docker.

Setup a docker network for the containers

docker network create fluent-bit_seq
Enter fullscreen modeExit fullscreen mode

Setting up Seq

At first setup a hashed password to be used

PH=$(echo 'seqPass%%' | docker run --rm -i datalust/seq config hash)
Enter fullscreen modeExit fullscreen mode

Make sure that the password variable is ok

echo $PH
Enter fullscreen modeExit fullscreen mode

Run the container

docker run --name seq -d --network fluent-bit_seq \    -p8080:80 --restart unless-stopped \    -e ACCEPT_EULA=Y -e SEQ_FIRSTRUN_ADMINPASSWORDHASH="$PH" \    datalust/seq
Enter fullscreen modeExit fullscreen mode

Now browse tolocalhost:8080 and login into Seq using username=admin password=seqPass%%

Logging into seq

After logging into seq

Setting up Fluent Bit

Designate a folder where you'll store the fluent bit configs. In my case the directory isD:/fluent-bit

Set the directory where fluent bit's config will come from

export sharedFolder=/var/fluent-bit_seq
Enter fullscreen modeExit fullscreen mode

Start a temporary container to copy default configs from

docker run -d --rm --name temp cr.fluentbit.io/fluent/fluent-bit
Enter fullscreen modeExit fullscreen mode

Copy the configs to your designated folder

docker cp temp:/fluent-bit/etc/ $sharedFolder
Enter fullscreen modeExit fullscreen mode

Stop the temporary container

docker stop temp
Enter fullscreen modeExit fullscreen mode

Now start fluent bit with the config folder mounted as a volume

docker run -dti --name fluent-bit --network fluent-bit_seq \    -v $sharedFolder:/fluent-bit/etc \      cr.fluentbit.io/fluent/fluent-bit
Enter fullscreen modeExit fullscreen mode

See what is in the shared folder directory

By default fluent bit is configured to output to std out. So see docker log to see what fluent bit is logging.

docker logs fluent-bit
Enter fullscreen modeExit fullscreen mode

Fluent bit logs

Configuring Fluent Bit to send logs to Seq

Go to the fluent bit configuration directory and search for this section

# fluent-bit.conf[OUTPUT]    name  stdout    match *
Enter fullscreen modeExit fullscreen mode

Replace this section with this and save

# fluent-bit.conf[OUTPUT]    Name             http    Match            *    Host             seq    Port             5341    URI              /api/events/raw?clef    Format           json_lines    Json_date_key    @t    Json_date_format iso8601    Log_response_payload False
Enter fullscreen modeExit fullscreen mode

Now restart the fluent bit container for the changes to take effect.

docker restart fluent-bit
Enter fullscreen modeExit fullscreen mode

after pasting the config

Now browse tolocalhost:8080 and login into Seq using username=admin password=seqPass%% and see that the logs are being written into Seq

Fluent bit is sending message to seq

Thanks for reading, Happy Tinkering :)

References

  1. Github repo

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I love tinkering with things and trying out any idea I get.
  • Location
    Bangladesh
  • Joined

More fromMinhaz

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp