fluent-bit-go icon indicating copy to clipboard operation
fluent-bit-go copied to clipboard

Handling log level and log format

Open kishaningithub opened this issue 4 years ago • 4 comments

Question 1 - Log level In fluent bit there is an option to configure the log level using the "Log_Level" configuration Documentation - https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/configuration-file

I would like to see some examples/pointers on how to read the same in the output plugin and perform logging appropriately.

Question 2 - Logging format What should be the logging format used by the plugin? I see no option in fluent-bit to configure the logging format (plain text vs structured etc) at fluent bit level.

Thanks in advance

kishaningithub avatar Jun 06 '21 12:06 kishaningithub

See #8, logging to main Log_File is not supported in a Go plugin. PRs welcome.

l2dy avatar Jun 06 '21 13:06 l2dy

In the below code, i see the log level is accessed through the env var FLB_LOG_LEVEL

https://github.com/aws/amazon-kinesis-firehose-for-fluent-bit/blob/9c442bbad45ccf975899d813bb4b319b61d21a4e/plugins/plugins.go#L31

I am not really sure has to how this env variable gets injected. @l2dy If possible can you point me towards the documentation for this? I was not able to find any in the official documentation?

kishaningithub avatar Jun 18 '21 07:06 kishaningithub

It's not injected by Fluent Bit. Instead, Fluent Bit itself also checks this environment variable.

https://github.com/fluent/fluent-bit/blob/03f3339594bdb472315823db78ca209b7ba319fb/src/flb_config.c#L433-L441

l2dy avatar Jun 18 '21 13:06 l2dy

Reviving an old issue but would it be possible to get a short example on how to use, if it still is possible. If not, get some hints on where to start to add this?

Minipada avatar Dec 14 '22 09:12 Minipada