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
Show 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 {
...
@@ -41,16 +41,13 @@ func FLBPluginInit(plugin unsafe.Pointer) int {
//export FLBPluginFlushCtx
//export FLBPluginFlushCtx
func
FLBPluginFlushCtx
(
ctx
,
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
int
{
func
FLBPluginFlushCtx
(
ctx
,
data
unsafe
.
Pointer
,
length
C
.
int
,
tag
*
C
.
char
)
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
)
dict
:=
output
.
FLBPluginGetContext
(
ctx
)
.
(
map
[
string
]
string
)
fmt
.
Printf
(
"streamtool_uri %s
\n
"
,
dict
[
"streamtool_uri"
])
// Iterate Records
// Iterate Records
count
=
0
var
result
string
var
result
string
result
=
""
result
=
""
for
{
for
{
...
@@ -72,12 +69,15 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
...
@@ -72,12 +69,15 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
}
}
// Print record keys and values
// Print record keys and values
result
=
result
+
C
.
GoString
(
tag
)
+
":["
+
timestamp
.
String
()
result
=
result
+
C
.
GoString
(
tag
)
+
":"
+
timestamp
.
String
()
for
k
,
v
:=
range
record
{
for
_
,
v
:=
range
record
{
result
=
result
+
fmt
.
Sprintf
(
"%s: %v"
,
k
,
v
)
result
+=
"["
for
_
,
s
:=
range
v
.
([]
uint8
)
{
result
=
result
+
string
(
s
)
}
}
result
+=
"}
\n
"
result
+=
"]"
count
++
}
result
+=
"
\n
"
}
}
// Return options:
// Return options:
...
@@ -88,6 +88,7 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
...
@@ -88,6 +88,7 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
//body result
//body result
// content type "application/octet-stream"
// content type "application/octet-stream"
//
//
fmt
.
Println
(
result
)
var
b
=
[]
byte
(
result
)
var
b
=
[]
byte
(
result
)
uri
:=
fmt
.
Sprintf
(
"%s/ingest?reference=#%s"
,
dict
[
"streamtool_uri"
],
C
.
GoString
(
tag
))
uri
:=
fmt
.
Sprintf
(
"%s/ingest?reference=#%s"
,
dict
[
"streamtool_uri"
],
C
.
GoString
(
tag
))
client
:=
&
http
.
Client
{
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