https://github.com/stevedsun/go-fluentbit-conf-parser
Go package for parsering Fluentbit classic-mode configuration file.
https://github.com/stevedsun/go-fluentbit-conf-parser
fluent-bit fluentbit go
Last synced: 11 months ago
JSON representation
Go package for parsering Fluentbit classic-mode configuration file.
- Host: GitHub
- URL: https://github.com/stevedsun/go-fluentbit-conf-parser
- Owner: stevedsun
- License: mit
- Created: 2022-05-02T14:40:25.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-06T08:55:17.000Z (about 4 years ago)
- Last Synced: 2025-05-30T17:06:09.424Z (about 1 year ago)
- Topics: fluent-bit, fluentbit, go
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fluent-Bit configuration parser for Golang
  
Go package for parsering [Fluentbit](https://fluentbit.io/) `.conf` configuration file.
> Read more: [Fluentbit Configuration Document](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/format-schema)
## 🍭 Features
- Support Section and Entry objects
- Support [Commands](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/commands)
- Export all entries of a section into a map object (`Section.EntryMap()`).
## 📦 Install
```shell
go get -u github.com/stevedsun/go-fluentbit-conf-parser
```
## ⌨ Usage
```go
package main
import (
"fmt"
"os"
parser "github.com/stevedsun/go-fluentbit-conf-parser"
)
func main() {
confFile, _ := os.Open("fluentbit.conf")
defer confFile.Close()
conf := parser.NewFluentBitConfParser(confFile).Parse()
for _, include := range conf.Includes {
fmt.Printf("@INCLUDE %v\n", include)
}
for key, value := range conf.Sets {
fmt.Printf("@SET %v=%v\n", key, value)
}
for _, section := range conf.Sections {
fmt.Printf("[%v]\n", section.Name)
for _, entry := range section.Entries {
fmt.Printf(" %v %v\n", entry.Key, entry.Value)
}
}
}
```