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
cbad0852
Commit
cbad0852
authored
Jun 08, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readable output
parent
d53dba5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/go_plugin/out_gstdout.go
src/go_plugin/out_gstdout.go
+9
-8
No files found.
src/go_plugin/out_gstdout.go
View file @
cbad0852
...
...
@@ -41,16 +41,13 @@ func FLBPluginInit(plugin unsafe.Pointer) int {
//export FLBPluginFlushCtx
func
FLBPluginFlushCtx
(
ctx
,
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
int
{
var
count
int
var
ret
int
var
ts
interface
{}
var
record
map
[
interface
{}]
interface
{}
// Create Fluent Bit decoder
dec
:=
output
.
NewDecoder
(
data
,
int
(
length
))
dict
:=
output
.
FLBPluginGetContext
(
ctx
)
.
(
map
[
string
]
string
)
fmt
.
Printf
(
"streamtool_uri %s
\n
"
,
dict
[
"streamtool_uri"
])
// Iterate Records
count
=
0
var
result
string
result
=
""
for
{
...
...
@@ -72,12 +69,15 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
}
// Print record keys and values
result
=
result
+
C
.
GoString
(
tag
)
+
":["
+
timestamp
.
String
()
for
k
,
v
:=
range
record
{
result
=
result
+
fmt
.
Sprintf
(
"%s: %v"
,
k
,
v
)
result
=
result
+
C
.
GoString
(
tag
)
+
":"
+
timestamp
.
String
()
for
_
,
v
:=
range
record
{
result
+=
"["
for
_
,
s
:=
range
v
.
([]
uint8
)
{
result
=
result
+
string
(
s
)
}
result
+=
"]"
}
result
+=
"}
\n
"
count
++
result
+=
"
\n
"
}
// Return options:
...
...
@@ -88,6 +88,7 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
//body result
// content type "application/octet-stream"
//
fmt
.
Println
(
result
)
var
b
=
[]
byte
(
result
)
uri
:=
fmt
.
Sprintf
(
"%s/ingest?reference=#%s"
,
dict
[
"streamtool_uri"
],
C
.
GoString
(
tag
))
client
:=
&
http
.
Client
{
...
...
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