Created
January 22, 2019 12:46
-
-
Save adrien-f/98e1202a2536a0011536fa43376370bd to your computer and use it in GitHub Desktop.
fluentbit with go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// #cgo CFLAGS: -I ../include/fluent-bit/include/ -I ../include/fluent-bit/lib/monkey/include/ -I ../include/fluent-bit/lib/mbedtls-2.14.1/include/ -I ../include/fluent-bit/lib/flb_libco/ -I ../include/fluent-bit/lib/onigmo/ -L../include/fluent-bit/build/lib/ | |
// #cgo LDFLAGS: -lfluent-bit | |
// #include "fluent-bit.h" | |
import "C" | |
import ( | |
"unsafe" | |
) | |
func main() { | |
fb := C.flb_create() | |
input := C.flb_input(fb, C.CString("lib"), nil) | |
_ = C.flb_output(fb, C.CString("stdout"), nil) | |
msgValue := "[1449505010, {\"key1\": \"some value\"}]" | |
C.flb_lib_push(fb, input, unsafe.Pointer(C.CString(msgValue)), C.ulong(len(msgValue))) | |
C.flb_stop(fb) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment