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
edfcd6d0
Commit
edfcd6d0
authored
May 28, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http post
parent
81da849f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
dracut.module/90metadata-collect/flb.conf
dracut.module/90metadata-collect/flb.conf
+1
-1
src/go_plugin/out_gstdout.go
src/go_plugin/out_gstdout.go
+19
-10
No files found.
dracut.module/90metadata-collect/flb.conf
View file @
edfcd6d0
...
...
@@ -7,7 +7,7 @@
[
output
]
name
wendelin_fluentbit
match
*
streamtool_uri
https
://
softinst14
3538
.
host
.
vifib
.
net
streamtool_uri
https
://
softinst14
0097
.
host
.
vifib
.
net
/
erp5
user
xx
password
xx
buffer_type
memory
...
...
src/go_plugin/out_gstdout.go
View file @
edfcd6d0
package
main
import
(
"bytes"
"C"
"fmt"
"time"
"os"
"unsafe"
"net/http"
"net/url"
"github.com/fluent/fluent-bit-go/output"
)
...
...
@@ -84,17 +84,26 @@ func FLBPluginFlushCtx(ctx, 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.
fmt
.
Printf
(
result
)
xxdata
:=
url
.
Values
{
"name"
:
{
result
},
"occupation"
:
{
"y"
},
//body result
// content type "application/octet-stream"
//
var
b
=
[]
byte
(
result
)
uri
:=
fmt
.
Sprintf
(
"%s/ingest?reference=#%s"
,
dict
[
"streamtool_uri"
],
C
.
GoString
(
tag
))
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
"POST"
,
uri
,
bytes
.
NewReader
(
b
))
if
err
!=
nil
{
fmt
.
Printf
(
"Got error %s"
,
err
.
Error
())
return
output
.
FLB_RETRY
}
res
,
err
:=
http
.
PostForm
(
"https://softinst140097.host.vifib.net/erp5/fluentbit_upload_test/"
,
xxdata
)
fmt
.
Printf
(
"%v"
,
res
)
if
err
==
nil
{
os
.
Exit
(
0
)
req
.
SetBasicAuth
(
dict
[
"user"
],
dict
[
"password"
])
req
.
Header
.
Set
(
"Content-Type"
,
"application/octet-stream"
)
rsp
,
_
:=
client
.
Do
(
req
)
if
rsp
.
StatusCode
!=
http
.
StatusOK
{
fmt
.
Printf
(
"status code %d"
,
rsp
.
StatusCode
)
return
output
.
FLB_RETRY
}
return
output
.
FLB_RETRY
os
.
Exit
(
0
)
return
output
.
FLB_OK
}
//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