Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
eagleEye
/
flume-interceptor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
de1f7bec
authored
Jan 14, 2025
by
魏建枢
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
拦截器增加openAPI
parent
d08466be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/TimestampeInterceptor.java
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/interceptor/InterceptorDataFormatUtil.java
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/interceptor/InterceptorSelector.java
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/TimestampeInterceptor.java
View file @
de1f7bec
...
...
@@ -30,7 +30,7 @@ public class TimestampeInterceptor implements Interceptor{
@Override
public
Event
intercept
(
Event
event
)
{
String
log
=
new
String
(
event
.
getBody
(),
StandardCharsets
.
UTF_8
);
System
.
out
.
println
(
"TimestampeInterceptor>>>>>>>>>>>>>>>>>>>>>开始"
+
log
);
System
.
out
.
println
(
"TimestampeInterceptor>>>>>>>>>>>>>>>>>>>>>开始"
);
JSONObject
jsonObj
=
new
JSONObject
();
try
{
jsonObj
=
JSONObject
.
parseObject
(
log
);
...
...
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/interceptor/InterceptorDataFormatUtil.java
View file @
de1f7bec
...
...
@@ -126,5 +126,17 @@ public class InterceptorDataFormatUtil {
arrayList
.
add
(
jsonObj
.
getString
(
"forwardType"
));
return
arrayList
;
}
public
static
List
<
String
>
openApiDataFormat
(
JSONObject
jsonObj
)
{
List
<
String
>
arrayList
=
new
ArrayList
<>();
arrayList
.
add
(
jsonObj
.
getString
(
"req_body"
));
arrayList
.
add
(
jsonObj
.
getString
(
"res_body"
));
arrayList
.
add
(
jsonObj
.
getString
(
"date_time"
));
arrayList
.
add
(
jsonObj
.
getString
(
"send_type"
));
arrayList
.
add
(
jsonObj
.
getString
(
"zone_code"
));
arrayList
.
add
(
jsonObj
.
getString
(
"zone_time"
));
arrayList
.
add
(
jsonObj
.
getString
(
"ua"
));
return
arrayList
;
}
}
flume-interceptor/src/main/java/com/org/apache/flume/interceptor/interceptor/InterceptorSelector.java
View file @
de1f7bec
...
...
@@ -31,6 +31,8 @@ public class InterceptorSelector {
return
dataSplit
(
InterceptorDataFormatUtil
.
sminCommunityAiClassDataFormat
(
jsonObj
));
}
else
if
(
StringUtils
.
equals
(
flume_type
,
"sminCommunityCollect"
))
{
return
dataSplit
(
InterceptorDataFormatUtil
.
sminCommunityCollectDataFormat
(
jsonObj
));
}
else
if
(
StringUtils
.
equals
(
flume_type
,
"openApi"
))
{
return
dataSplit
(
InterceptorDataFormatUtil
.
openApiDataFormat
(
jsonObj
));
}
return
resultStr
;
}
...
...
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