Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vernedeng committed Aug 3, 2024
1 parent f00bcfc commit 22dfe33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public List<EsIndexRequest> parse(
EsIdConfig idConfig = context.getIdConfig(uid);
String indexName = idConfig.parseIndexName(event.getRawLogTime());
byte[] bodyBytes = event.getBody();
String strContext = new String(bodyBytes, Charset.defaultCharset());
String strContext = new String(bodyBytes, idConfig.getCharset());
// build
List<Map<String, Object>> esData = processor.transform(strContext);
return esData.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -71,6 +72,7 @@ protected SimpleDateFormat initialValue() {
private int fieldOffset = 2; // for ftime,extinfo
private int contentOffset = 0;// except for boss + tab(1)
private List<String> fieldList;
private Charset charset;

public static EsIdConfig create(DataFlowConfig dataFlowConfig) {
EsSinkConfig sinkConfig = (EsSinkConfig) dataFlowConfig.getSinkConfig();
Expand All @@ -86,6 +88,7 @@ public static EsIdConfig create(DataFlowConfig dataFlowConfig) {
.separator(sinkConfig.getSeparator())
.indexNamePattern(sinkConfig.getIndexNamePattern())
.fieldList(fields)
.charset(Charset.forName(sinkConfig.getEncodingType()))
.build();
}

Expand Down

0 comments on commit 22dfe33

Please sign in to comment.