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
c4dc05e7
Commit
c4dc05e7
authored
May 27, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example to stop after success
parent
fd4571bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
src/go_plugin/out_gstdout.go
src/go_plugin/out_gstdout.go
+16
-14
No files found.
src/go_plugin/out_gstdout.go
View file @
c4dc05e7
...
...
@@ -32,20 +32,13 @@ func FLBPluginFlush(data unsafe.Pointer, length C.int, tag *C.char) int {
var
ret
int
var
ts
interface
{}
var
record
map
[
interface
{}]
interface
{}
xxdata
:=
url
.
Values
{
"name"
:
{
"x"
},
"occupation"
:
{
"y"
},
}
_
,
err
:=
http
.
PostForm
(
"https://softinst140097.host.vifib.net/erp5/fluentbit_upload_test/"
,
xxdata
)
if
err
==
nil
{
os
.
Exit
(
0
)
}
// Create Fluent Bit decoder
dec
:=
output
.
NewDecoder
(
data
,
int
(
length
))
// Iterate Records
count
=
0
var
result
string
result
=
""
for
{
// Extract Record
ret
,
ts
,
record
=
output
.
GetRecord
(
dec
)
...
...
@@ -65,12 +58,11 @@ func FLBPluginFlush(data unsafe.Pointer, length C.int, tag *C.char) int {
}
// Print record keys and values
fmt
.
Printf
(
"[%d] %s: [%s, {"
,
count
,
C
.
GoString
(
tag
),
timestamp
.
String
())
result
=
result
+
C
.
GoString
(
tag
)
+
":["
+
timestamp
.
String
()
for
k
,
v
:=
range
record
{
fmt
.
Printf
(
"
\"
%s
\"
: %v, "
,
k
,
v
)
result
=
result
+
fmt
.
Sprintf
(
"%s: %v"
,
k
,
v
)
}
fmt
.
Printf
(
"}
\n
"
)
result
+=
"}
\n
"
count
++
}
...
...
@@ -79,7 +71,17 @@ func FLBPluginFlush(data unsafe.Pointer, length C.int, tag *C.char) int {
// output.FLB_OK = data have been processed.
// output.FLB_ERROR = unrecoverable error, do not try this again.
// output.FLB_RETRY = retry to flush later.
return
output
.
FLB_OK
fmt
.
Printf
(
result
)
xxdata
:=
url
.
Values
{
"name"
:
{
result
},
"occupation"
:
{
"y"
},
}
res
,
err
:=
http
.
PostForm
(
"https://softinst140097.host.vifib.net/erp5/fluentbit_upload_test/"
,
xxdata
)
fmt
.
Printf
(
"%v"
,
res
)
if
err
==
nil
{
os
.
Exit
(
0
)
}
return
output
.
FLB_RETRY
}
//export FLBPluginExit
...
...
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