Commit 5236bcd6 by txy

切割文件名称

parent 66886203
...@@ -88,8 +88,21 @@ public class YunnanFileSink extends AbstractSink implements Configurable, BatchS ...@@ -88,8 +88,21 @@ public class YunnanFileSink extends AbstractSink implements Configurable, BatchS
} }
public void dealData(String fileName, List<Event> eventList) throws IOException { public void dealData(String fileName, List<Event> eventList) throws IOException {
logger.info("没有切割之前的fileName的值"+fileName);
if (eventList.size() == 0) if (eventList.size() == 0)
return; return;
String[] split = fileName.split(",");
for(int i=0;i<split.length;i++){
String a=split[i];
if("filerecord".equals(a)){
fileName=fileName.replace("filerecord","file,record");
logger.info("filerecord 切割后的值"+fileName);
}
if("filedefault".equals(a)){
fileName=fileName.replace("filedefault","file,default");
logger.info("filedefault 切割后的值"+fileName);
}
}
fileName = fileName.replaceAll(",,", ",").replaceAll(",", "\\/"); fileName = fileName.replaceAll(",,", ",").replaceAll(",", "\\/");
String uploadDir = "/" + fileName; String uploadDir = "/" + fileName;
String dir = uploadDir.substring(0, uploadDir.lastIndexOf("/")); String dir = uploadDir.substring(0, uploadDir.lastIndexOf("/"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment