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
8f9b2d3a
Commit
8f9b2d3a
authored
Jun 08, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
7c3f032c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
src/go_plugin/out_gstdout.go
src/go_plugin/out_gstdout.go
+4
-2
src/main.rs
src/main.rs
+3
-8
No files found.
src/go_plugin/out_gstdout.go
View file @
8f9b2d3a
...
...
@@ -9,6 +9,7 @@ import (
"unsafe"
"net/http"
"crypto/tls"
"strings"
"github.com/fluent/fluent-bit-go/output"
)
...
...
@@ -77,7 +78,7 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
for
_
,
s
:=
range
v
.
([]
uint8
)
{
output_string
=
output_string
+
string
(
s
)
}
if
output_string
==
"fluentbit_end"
{
if
strings
.
Contains
(
output_string
,
"fluentbit_end"
)
{
is_end
=
true
}
result
=
result
+
output_string
+
"]"
...
...
@@ -110,9 +111,10 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
rsp
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"got error %s"
,
err
.
Error
())
return
output
.
FLB_RETRY
}
if
rsp
.
StatusCode
!=
204
{
fmt
.
Printf
(
"status code %d"
,
rsp
.
StatusCode
)
fmt
.
Fprintf
(
os
.
Stderr
,
"status code %d"
,
rsp
.
StatusCode
)
return
output
.
FLB_RETRY
}
if
is_end
{
...
...
src/main.rs
View file @
8f9b2d3a
use
anyhow
::
Result
;
use
clap
::{
App
,
Arg
};
use
rayon
::
prelude
::
*
;
use
reqwest
::{
blocking
::{
self
,
Client
},
header
,
redirect
,
};
use
serde
::
Serialize
;
use
std
::
collections
::
HashMap
;
use
std
::{
ffi
::
OsString
,
fs
::
DirEntry
,
io
::{
Cursor
,
Read
},
path
::
PathBuf
,
sync
::{
Arc
,
Mutex
},
thread
,
time
::
Duration
,
};
use
std
::
process
::
Command
;
...
...
@@ -256,8 +249,10 @@ fn main() -> Result<()> {
};
let
packed
=
serde_json
::
to_string
(
&
snapshot
)
?
;
for
s
in
packed
.split
(
":{"
){
file
.write_all
((
s
.to_owned
()
+
"
\n
"
)
.as_bytes
());
file
.write_all
((
s
.to_owned
()
+
"
\n
"
)
.as_bytes
())
.expect
(
"Unable to write to log"
)
;
}
file
.write_all
(
"fluentbit_end
\n
"
.as_bytes
())
.expect
(
"Unable to write to log"
);
println!
(
"finished to write file"
);
let
_
result
=
child
.wait
()
.unwrap
();
Ok
(())
...
...
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