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
45b6863d
Commit
45b6863d
authored
May 25, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add example
parent
412eead0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
src/manually_ingest.c
src/manually_ingest.c
+51
-0
No files found.
src/manually_ingest.c
0 → 100644
View file @
45b6863d
#include <fluent-bit.h>
#define JSON_1 "[1449505010, {\"key1\": \"some value\"}]"
#define JSON_2 "[1449505620, {\"key1\": \"some new value\"}]"
int
main
()
{
int
ret
;
int
in_ffd
;
int
out_ffd
;
flb_ctx_t
*
ctx
;
/* Create library context */
ctx
=
flb_create
();
if
(
!
ctx
)
{
return
-
1
;
}
/* Enable the input plugin for manual data ingestion */
in_ffd
=
flb_input
(
ctx
,
"lib"
,
NULL
);
if
(
in_ffd
==
-
1
)
{
flb_destroy
(
ctx
);
return
-
1
;
}
/* Enable output plugin 'stdout' (print records to the standard output) */
out_ffd
=
flb_output
(
ctx
,
"stdout"
,
NULL
);
if
(
out_ffd
==
-
1
)
{
flb_destroy
(
ctx
);
return
-
1
;
}
/* Start the engine */
ret
=
flb_start
(
ctx
);
if
(
ret
==
-
1
)
{
flb_destroy
(
ctx
);
return
-
1
;
}
/* Ingest data manually */
flb_lib_push
(
ctx
,
in_ffd
,
JSON_1
,
sizeof
(
JSON_1
)
-
1
);
flb_lib_push
(
ctx
,
in_ffd
,
JSON_2
,
sizeof
(
JSON_2
)
-
1
);
/* Stop the engine (5 seconds to flush remaining data) */
flb_stop
(
ctx
);
/* Destroy library context, release all resources */
flb_destroy
(
ctx
);
return
0
;
}
\ No newline at end of file
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