Skip to content

Commit d0c2b5c

Browse files
committed
Rename this parameter and some variables
1 parent d7bf4c8 commit d0c2b5c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/CefParser.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
import static org.elasticsearch.ingest.common.CefParser.DataType.TimestampType;
5454

5555
final class CefParser {
56-
private final boolean removeEmptyValue;
56+
private final boolean removeEmptyValues;
5757
private final ZoneId timezone;
5858

59-
CefParser(ZoneId timezone, boolean removeEmptyValue) {
60-
this.removeEmptyValue = removeEmptyValue;
59+
CefParser(ZoneId timezone, boolean removeEmptyValues) {
60+
this.removeEmptyValues = removeEmptyValues;
6161
this.timezone = timezone;
6262
}
6363

@@ -368,8 +368,8 @@ private void processExtensions(String cefString, int extensionStart, CefEvent ev
368368
String extensionString = cefString.substring(extensionStart);
369369
final Map<String, String> parsedExtensions = parseExtensions(extensionString);
370370
// Cleanup empty values in extensions
371-
if (removeEmptyValue) {
372-
removeEmptyValue(parsedExtensions);
371+
if (removeEmptyValues) {
372+
removeEmptyValues(parsedExtensions);
373373
}
374374
// Translate extensions to possible ECS fields
375375
for (Map.Entry<String, String> entry : parsedExtensions.entrySet()) {
@@ -508,7 +508,7 @@ private static String insertMACSeparators(String v) {
508508
return sb.toString();
509509
}
510510

511-
private static void removeEmptyValue(Map<String, String> map) {
511+
private static void removeEmptyValues(Map<String, String> map) {
512512
map.values().removeIf(Strings::isEmpty);
513513
}
514514

modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/CefProcessor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public final class CefProcessor extends AbstractProcessor {
3030
final String field;
3131
final String targetField;
3232
final boolean ignoreMissing;
33-
final boolean removeEmptyValue;
33+
final boolean ignoreEmptyValues;
3434
private final TemplateScript.Factory timezone;
3535

3636
CefProcessor(
@@ -39,14 +39,14 @@ public final class CefProcessor extends AbstractProcessor {
3939
String field,
4040
String targetField,
4141
boolean ignoreMissing,
42-
boolean removeEmptyValue,
42+
boolean ignoreEmptyValues,
4343
@Nullable TemplateScript.Factory timezone
4444
) {
4545
super(tag, description);
4646
this.field = field;
4747
this.targetField = targetField;
4848
this.ignoreMissing = ignoreMissing;
49-
this.removeEmptyValue = removeEmptyValue;
49+
this.ignoreEmptyValues = ignoreEmptyValues;
5050
this.timezone = timezone;
5151
}
5252

@@ -59,7 +59,7 @@ public IngestDocument execute(IngestDocument document) {
5959
throw new IllegalArgumentException("field [" + field + "] is null, cannot process it.");
6060
}
6161
ZoneId timezone = getTimezone(document);
62-
try (CefEvent event = new CefParser(timezone, removeEmptyValue).process(line)) {
62+
try (CefEvent event = new CefParser(timezone, ignoreEmptyValues).process(line)) {
6363
event.getRootMappings().forEach(document::setFieldValue);
6464
event.getCefMappings().forEach((k, v) -> document.setFieldValue(targetField + "." + k, v));
6565
}
@@ -97,7 +97,7 @@ public CefProcessor create(
9797
ProjectId projectId
9898
) {
9999
String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");
100-
boolean removeEmptyValue = ConfigurationUtils.readBooleanProperty(TYPE, processorTag, config, "ignore_empty_value", true);
100+
boolean ignoreEmptyValues = ConfigurationUtils.readBooleanProperty(TYPE, processorTag, config, "ignore_empty_values", true);
101101
boolean ignoreMissing = ConfigurationUtils.readBooleanProperty(TYPE, processorTag, config, "ignore_missing", false);
102102
String targetField = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "target_field", "cef");
103103
String timezoneString = ConfigurationUtils.readOptionalStringProperty(TYPE, processorTag, config, "timezone");
@@ -118,7 +118,7 @@ public CefProcessor create(
118118
field,
119119
targetField,
120120
ignoreMissing,
121-
removeEmptyValue,
121+
ignoreEmptyValues,
122122
compiledTimezoneTemplate
123123
);
124124
}

modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/CefProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ public void testTruncatedHeader() {
668668
);
669669
}
670670

671-
public void testRemoveEmptyValueInExtension() {
671+
public void testIgnoreEmptyValuesInExtension() {
672672
String message = "CEF:26|security|threat=manager|1.0|100|trojan successfully stopped|10|src= dst=12.121.122.82 spt=";
673673
Map<String, Object> source = new HashMap<>();
674674
source.put("message", message);

0 commit comments

Comments
 (0)