Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
metadata-collect-agent
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
metadata-collect-agent
Commits
81da849f
Commit
81da849f
authored
May 28, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example to get parameters
parent
c4dc05e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
15 deletions
+31
-15
dracut.module/90metadata-collect/flb.conf
dracut.module/90metadata-collect/flb.conf
+10
-7
src/go_plugin/out_gstdout.go
src/go_plugin/out_gstdout.go
+20
-7
src/go_plugin/out_gstdout.h
src/go_plugin/out_gstdout.h
+1
-1
No files found.
dracut.module/90metadata-collect/flb.conf
View file @
81da849f
[
SERVICE
]
[
SERVICE
]
Flush
5
flush
5
Daemon
off
[
INPUT
]
[
INPUT
]
N
ame
cpu
n
ame
cpu
[
output
]
[
output
]
Name
http
name
wendelin_fluentbit
Match
*
match
*
Host
softinst143538
.
host
.
vifib
.
net
streamtool_uri
https
://
softinst143538
.
host
.
vifib
.
net
URI
/
erp5
/
fluentbit_upload_test
user
xx
password
xx
buffer_type
memory
flush_interval
60
s
disable_retry_limit
true
src/go_plugin/out_gstdout.go
View file @
81da849f
...
@@ -13,28 +13,41 @@ import (
...
@@ -13,28 +13,41 @@ import (
//export FLBPluginRegister
//export FLBPluginRegister
func
FLBPluginRegister
(
def
unsafe
.
Pointer
)
int
{
func
FLBPluginRegister
(
def
unsafe
.
Pointer
)
int
{
return
output
.
FLBPluginRegister
(
def
,
"
gstdout"
,
"Stdout GO!
"
)
return
output
.
FLBPluginRegister
(
def
,
"
wendelin_fluentbit"
,
"Wendelin Fluentbit
"
)
}
}
//export FLBPluginInit
//export FLBPluginInit
// (fluentbit will call this)
// (fluentbit will call this)
// plugin (context) pointer to fluentbit context (state/ c code)
// plugin (context) pointer to fluentbit context (state/ c code)
func
FLBPluginInit
(
plugin
unsafe
.
Pointer
)
int
{
func
FLBPluginInit
(
plugin
unsafe
.
Pointer
)
int
{
// Example to retrieve an optional configuration parameter
streamtool_uri
:=
output
.
FLBPluginConfigKey
(
plugin
,
"streamtool_uri"
)
param
:=
output
.
FLBPluginConfigKey
(
plugin
,
"param"
)
user
:=
output
.
FLBPluginConfigKey
(
plugin
,
"user"
)
fmt
.
Printf
(
"[flb-go] plugin parameter = '%s'
\n
"
,
param
)
password
:=
output
.
FLBPluginConfigKey
(
plugin
,
"password"
)
buffer_type
:=
output
.
FLBPluginConfigKey
(
plugin
,
"buffer_type"
)
flush_interval
:=
output
.
FLBPluginConfigKey
(
plugin
,
"flush_interval"
)
disable_retry_limit
:=
output
.
FLBPluginConfigKey
(
plugin
,
"disable_retry_limit"
)
dict
:=
map
[
string
]
string
{
"streamtool_uri"
:
streamtool_uri
,
"user"
:
user
,
"password"
:
password
,
"buffer_type"
:
buffer_type
,
"flush_interval"
:
flush_interval
,
"disable_retry_limit"
:
disable_retry_limit
,
}
output
.
FLBPluginSetContext
(
plugin
,
dict
)
return
output
.
FLB_OK
return
output
.
FLB_OK
}
}
//export FLBPluginFlush
//export FLBPluginFlush
Ctx
func
FLBPluginFlush
(
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
int
{
func
FLBPluginFlush
Ctx
(
ctx
,
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
int
{
var
count
int
var
count
int
var
ret
int
var
ret
int
var
ts
interface
{}
var
ts
interface
{}
var
record
map
[
interface
{}]
interface
{}
var
record
map
[
interface
{}]
interface
{}
// Create Fluent Bit decoder
// Create Fluent Bit decoder
dec
:=
output
.
NewDecoder
(
data
,
int
(
length
))
dec
:=
output
.
NewDecoder
(
data
,
int
(
length
))
dict
:=
output
.
FLBPluginGetContext
(
ctx
)
.
(
map
[
string
]
string
)
fmt
.
Printf
(
"streamtool_uri %s
\n
"
,
dict
[
"streamtool_uri"
])
// Iterate Records
// Iterate Records
count
=
0
count
=
0
var
result
string
var
result
string
...
...
src/go_plugin/out_gstdout.h
View file @
81da849f
...
@@ -73,7 +73,7 @@ extern GoInt FLBPluginRegister(void* def);
...
@@ -73,7 +73,7 @@ extern GoInt FLBPluginRegister(void* def);
// (fluentbit will call this)
// (fluentbit will call this)
// plugin (context) pointer to fluentbit context (state/ c code)
// plugin (context) pointer to fluentbit context (state/ c code)
extern
GoInt
FLBPluginInit
(
void
*
plugin
);
extern
GoInt
FLBPluginInit
(
void
*
plugin
);
extern
GoInt
FLBPluginFlush
(
void
*
data
,
int
length
,
char
*
tag
);
extern
GoInt
FLBPluginFlush
Ctx
(
void
*
ctx
,
void
*
data
,
int
length
,
char
*
tag
);
extern
GoInt
FLBPluginExit
();
extern
GoInt
FLBPluginExit
();
#ifdef __cplusplus
#ifdef __cplusplus
...
...
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