Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
slapos
Commits
315410d1
Commit
315410d1
authored
Jan 17, 2018
by
Eteri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fluentbit: add wendelin plugin (hardcoced params)
parent
ad5f9532
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
36 deletions
+36
-36
software/fluentbit/instance.cfg.in
software/fluentbit/instance.cfg.in
+1
-1
software/fluentbit/wendelin-plugin/conf.cnf
software/fluentbit/wendelin-plugin/conf.cnf
+10
-3
software/fluentbit/wendelin-plugin/out_wendelin.go
software/fluentbit/wendelin-plugin/out_wendelin.go
+25
-32
No files found.
software/fluentbit/instance.cfg.in
View file @
315410d1
...
...
@@ -20,7 +20,7 @@ bin = ${:home}/bin
[fluentbit-service]
recipe = slapos.cookbook:wrapper
command-line =
{{ fluentbit_source_location }}/build/bin/fluent-bit
-c {{ wendelin_conf_file }}/conf.cnf
-e
{{ fluentbit_source_location }}/build/bin/fluent-bit -e
{{ wendelin_test_path}}/{{ wendelin_plugin_filename }}.so
-i cpu -o wendelin_out -v
wrapper-path = ${directory:service}/fluentbit-service
...
...
software/fluentbit/wendelin-plugin/conf.cnf
View file @
315410d1
[SERVICE]
Flush 5
Daemon off
Log_Level debug
[INPUT]
Name cpu
Tag cpu
[OUTPUT]
Name
http
Name
wendelin_out
Match *
Host softinst84835.host.vifib.net
URI /erp5
\ No newline at end of file
Host https://softinst84835.host.vifib.net/erp5/portal_ingestion_policies
URI /fluentbit_test
USER zope
PASSWORD dbguyl
software/fluentbit/wendelin-plugin/out_wendelin.go
View file @
315410d1
...
...
@@ -5,6 +5,10 @@ import (
"fmt"
"unsafe"
"C"
"net/http"
"strconv"
"bytes"
)
//export FLBPluginRegister
...
...
@@ -17,50 +21,39 @@ func FLBPluginRegister(ctx unsafe.Pointer) int {
// ctx (context) pointer to fluentbit context (state/ c code)
func
FLBPluginInit
(
ctx
unsafe
.
Pointer
)
int
{
// Example to retrieve an optional configuration parameter
param
:=
output
.
FLBPluginConfigKey
(
ctx
,
"param"
)
/*
param := output.FLBPluginConfigKey(ctx, "param")
user := output.FLBPluginConfigKey(ctx, "user")
password := output.FLBPluginConfigKey(ctx, "password")
uri := output.FLBPluginConfigKey(ctx, "uri")
fmt
.
Printf
(
"[flb-go] plugin parameter = '%s'
\n
"
,
param
)
fmt
.
Printf
(
"[flb-go] plugin parameter = '%s'
\n
"
,
user
)
fmt
.
Printf
(
"[flb-go] plugin parameter = '%s'
\n
"
,
password
)
fmt
.
Printf
(
"[flb-go] plugin parameter = '%s'
\n
"
,
uri
)
//fmt.Printf("[flb-go] plugin parameter = '%s'\n", param)
fmt.Printf("[flb-go user] plugin parameter = '%s'\n", user)
fmt.Printf("[flb-go password] plugin parameter = '%s'\n", password)
fmt.Printf("[flb-go uri] plugin parameter = '%s'\n", uri)
*/
return
output
.
FLB_OK
}
//export FLBPluginFlush
func
FLBPluginFlush
(
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
int
{
// change here for wendelin
var
b
[]
byte
b
=
C
.
GoBytes
(
data
,
C
.
int
(
length
))
// var count int
// var ret int
// var ts interface{}
// var record map[interface{}]interface{}
/*
// Create Fluent Bit decoder
dec := output.NewDecoder(data, int(length))
// Iterate Records
count = 0
for {
// Extract Record
ret, ts, record = output.GetRecord(dec)
if ret != 0 {
break
}
var
username
string
=
"zope"
var
passwd
string
=
"dbguylpn"
hc
:=
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
"POST"
,
"https://softinst84835.host.vifib.net/erp5/portal_ingestion_policies/fluentbit_test/ingest?reference=fluentbit_test"
,
bytes
.
NewBuffer
(
b
))
req
.
Header
.
Set
(
"Content-Type"
,
"application/octet-stream"
)
req
.
SetBasicAuth
(
username
,
passwd
)
resp
,
err
:=
hc
.
Do
(
req
)
fmt
.
Println
(
resp
.
Status
)
fmt
.
Println
(
err
)
defer
resp
.
Body
.
Close
()
// Print record keys and values
timestamp := ts.(output.FLBTime)
fmt.Printf("[%d] %s: [%s, {", count, C.GoString(tag),
timestamp.String())
for k, v := range record {
fmt.Printf("\"%s\": %v, ", k, v)
}
fmt.Printf("}\n")
count++
}
*/
// Return options:
//
// output.FLB_OK = data have been processed.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment