diff --git a/data-prepper-api/src/main/java/org/opensearch/dataprepper/logging/DataPrepperMarkers.java b/data-prepper-api/src/main/java/org/opensearch/dataprepper/logging/DataPrepperMarkers.java index adf60dd5c2..a15dd52480 100644 --- a/data-prepper-api/src/main/java/org/opensearch/dataprepper/logging/DataPrepperMarkers.java +++ b/data-prepper-api/src/main/java/org/opensearch/dataprepper/logging/DataPrepperMarkers.java @@ -10,7 +10,6 @@ public final class DataPrepperMarkers { static { EVENT.add(SENSITIVE); - NOISY.add(SENSITIVE); } private DataPrepperMarkers() {} diff --git a/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/DelayProcessor.java b/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/DelayProcessor.java index edcd90f718..471c7c5c8f 100644 --- a/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/DelayProcessor.java +++ b/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/DelayProcessor.java @@ -35,7 +35,7 @@ public Collection> execute(final Collection> records) { try { Thread.sleep(delayDuration.toMillis()); } catch (final InterruptedException ex) { - LOG.error(NOISY,"Interrupted during delay processor", ex); + LOG.error(NOISY, "Interrupted during delay processor", ex); } return records; } diff --git a/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/StringProcessor.java b/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/StringProcessor.java index a928c481df..ff18a1e629 100644 --- a/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/StringProcessor.java +++ b/data-prepper-plugins/common/src/main/java/org/opensearch/dataprepper/plugins/processor/StringProcessor.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor; @@ -83,7 +84,13 @@ public Collection> execute(final Collection> records .build(); modifiedRecords.add(new Record<>(newRecordEvent)); } catch (JsonProcessingException e) { - LOG.error(NOISY, "Unable to process Event data: {}", eventJson, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Unable to process Event data: {}") + .addArgument(eventJson) + .setCause(e) + .log(); } } return modifiedRecords; diff --git a/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessor.java b/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessor.java index 575651e0b6..e9b4be67df 100644 --- a/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessor.java +++ b/data-prepper-plugins/csv-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/csv/CsvProcessor.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.dataformat.csv.CsvSchema; import io.micrometer.core.instrument.Counter; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -104,7 +105,13 @@ public Collection> doExecute(final Collection> recor } } catch (final IOException e) { csvInvalidEventsCounter.increment(); - LOG.error(NOISY, "An exception occurred while reading event [{}]", event, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("An exception occurred while reading event [{}]") + .addArgument(event) + .setCause(e) + .log(); } } return records; diff --git a/data-prepper-plugins/dissect-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/dissect/DissectProcessor.java b/data-prepper-plugins/dissect-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/dissect/DissectProcessor.java index 4a9ec927ee..952b6a684c 100644 --- a/data-prepper-plugins/dissect-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/dissect/DissectProcessor.java +++ b/data-prepper-plugins/dissect-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/dissect/DissectProcessor.java @@ -6,6 +6,8 @@ package org.opensearch.dataprepper.plugins.processor.dissect; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor; @@ -26,8 +28,6 @@ import java.util.Map; import java.util.Objects; -import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; - @DataPrepperPlugin(name = "dissect", pluginType = Processor.class, pluginConfigurationType = DissectProcessorConfig.class) public class DissectProcessor extends AbstractProcessor, Record> { @@ -72,7 +72,13 @@ public Collection> doExecute(Collection> records) { } } } catch (Exception ex){ - LOG.error(NOISY, "Error dissecting the event [{}] ", record.getData(), ex); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Unable to process Event data: {}") + .addArgument(record.getData()) + .setCause(ex) + .log(); } } return records; diff --git a/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessor.java b/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessor.java index a9d8fcf6ee..5605fbee45 100644 --- a/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessor.java +++ b/data-prepper-plugins/grok-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/grok/GrokProcessor.java @@ -12,6 +12,7 @@ import io.micrometer.core.instrument.Counter; import io.micrometer.core.instrument.Timer; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -152,11 +153,25 @@ public Collection> doExecute(final Collection> recor } catch (final TimeoutException e) { event.getMetadata().addTags(tagsOnTimeout); - LOG.error(NOISY, "Matching on record [{}] took longer than [{}] and timed out", record.getData(), grokProcessorConfig.getTimeoutMillis()); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Matching on record [{}] took longer than [{}] and timed out") + .addArgument(record.getData()) + .addArgument(grokProcessorConfig.getTimeoutMillis()) + .log(); + grokProcessingTimeoutsCounter.increment(); } catch (final ExecutionException | InterruptedException | RuntimeException e) { event.getMetadata().addTags(tagsOnMatchFailure); - LOG.error(NOISY, "An exception occurred when matching record [{}]", record.getData(), e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("An exception occurred when matching record [{}]") + .addArgument(record.getData()) + .setCause(e) + .log(); + grokProcessingErrorsCounter.increment(); } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessor.java index 7e837ea57a..321d4eebdc 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/AddEntryProcessor.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.processor.mutateevent; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -91,12 +92,28 @@ public Collection> doExecute(final Collection> recor } } } catch (Exception e) { - LOG.error(NOISY, "Error adding entry to record [{}] with key [{}], metadataKey [{}], value_expression [{}] format [{}], value [{}]", - recordEvent, entry.getKey(), entry.getMetadataKey(), entry.getValueExpression(), entry.getFormat(), entry.getValue(), e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Error adding entry to record [{}] with key [{}], metadataKey [{}], value_expression [{}] format [{}], value [{}]") + .addArgument(recordEvent) + .addArgument(entry.getKey()) + .addArgument(entry.getMetadataKey()) + .addArgument(entry.getValueExpression()) + .addArgument(entry.getFormat()) + .addArgument(entry.getValue()) + .setCause(e) + .log(); } } } catch(final Exception e){ - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessor.java index 1f0fc31e76..2f71e6fc03 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ConvertEntryTypeProcessor.java @@ -91,7 +91,13 @@ public Collection> doExecute(final Collection> recor } } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); recordEvent.getMetadata().addTags(tagsOnFailure); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessor.java index 7f9fd549d3..fdaae6ab19 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessor.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.processor.mutateevent; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -92,7 +93,13 @@ public Collection> doExecute(final Collection> recor } } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/DeleteEntryProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/DeleteEntryProcessor.java index 7ed489ccf1..8e483cfd05 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/DeleteEntryProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/DeleteEntryProcessor.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.processor.mutateevent; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -61,7 +62,13 @@ public Collection> doExecute(final Collection> recor recordEvent.delete(entry); } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessor.java index ceb72470ea..7cc6ba237a 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/ListToMapProcessor.java @@ -78,7 +78,13 @@ public Collection> doExecute(final Collection> recor recordEvent.getMetadata().addTags(config.getTagsOnFailure()); continue; } catch (final Exception e) { - LOG.error(NOISY, "Error converting source list to map on record [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Error converting source list to map on record [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); recordEvent.getMetadata().addTags(config.getTagsOnFailure()); continue; } @@ -86,11 +92,23 @@ public Collection> doExecute(final Collection> recor try { updateEvent(recordEvent, targetMap); } catch (final Exception e) { - LOG.error(NOISY, "Error updating record [{}] after converting source list to map", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Error updating record [{}] after converting source list to map") + .addArgument(recordEvent) + .setCause(e) + .log(); recordEvent.getMetadata().addTags(config.getTagsOnFailure()); } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); recordEvent.getMetadata().addTags(config.getTagsOnFailure()); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessor.java index 999b255f77..af291ebc05 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/MapToListProcessor.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -91,11 +92,22 @@ public Collection> doExecute(final Collection> recor recordEvent.put(config.getTarget(), targetList); } } catch (Exception e) { - LOG.error(NOISY,"Fail to perform Map to List operation", e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Fail to perform Map to List operation") + .setCause(e) + .log(); recordEvent.getMetadata().addTags(config.getTagsOnFailure()); } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); recordEvent.getMetadata().addTags(config.getTagsOnFailure()); } } diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessor.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessor.java index 08e40e831f..4244ac946f 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessor.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessor.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.processor.mutateevent; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -70,6 +71,13 @@ public Collection> doExecute(final Collection> recor } } catch (final Exception e) { LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/AbstractStringProcessor.java b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/AbstractStringProcessor.java index 7653b9fb28..5ea2abcd57 100644 --- a/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/AbstractStringProcessor.java +++ b/data-prepper-plugins/mutate-string-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutatestring/AbstractStringProcessor.java @@ -37,6 +37,13 @@ public Collection> doExecute(final Collection> recor performStringAction(recordEvent); } catch (final Exception e) { LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessor.java b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessor.java index 6076df6a3d..50a05d86cb 100644 --- a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessor.java +++ b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessor.java @@ -100,6 +100,11 @@ public ObfuscationProcessor(final PluginMetrics pluginMetrics, patterns.add(p); } catch (Exception e) { LOG.error(NOISY,e.getMessage()); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage(e.getMessage()) + .log(); throw new InvalidPluginConfigurationException("Invalid Pattern: \"" + rawPattern + "\" for source field " + this.source); } } diff --git a/data-prepper-plugins/translate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/translate/TranslateProcessor.java b/data-prepper-plugins/translate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/translate/TranslateProcessor.java index f61757a194..682936c5b7 100644 --- a/data-prepper-plugins/translate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/translate/TranslateProcessor.java +++ b/data-prepper-plugins/translate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/translate/TranslateProcessor.java @@ -8,6 +8,7 @@ import org.apache.commons.lang3.Range; import org.apache.commons.lang3.math.NumberUtils; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -66,8 +67,14 @@ public Collection> doExecute(Collection> records) { translateSource(sourceObject, recordEvent, targetConfig); } } catch (Exception ex) { - LOG.error(NOISY, "Error mapping the source [{}] of entry [{}]", mappingConfig.getSource(), - record.getData(), ex); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("Error mapping the source [{}] of entry [{}]") + .addArgument(mappingConfig.getSource()) + .addArgument(record.getData()) + .setCause(ex) + .log(); } } } diff --git a/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessor.java b/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessor.java index 488e93759a..6b5e4dd9fb 100644 --- a/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessor.java +++ b/data-prepper-plugins/truncate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/truncate/TruncateProcessor.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.processor.truncate; import org.opensearch.dataprepper.expression.ExpressionEvaluator; +import static org.opensearch.dataprepper.logging.DataPrepperMarkers.EVENT; import static org.opensearch.dataprepper.logging.DataPrepperMarkers.NOISY; import org.opensearch.dataprepper.metrics.PluginMetrics; import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; @@ -114,7 +115,13 @@ public Collection> doExecute(final Collection> recor } } } catch (final Exception e) { - LOG.error(NOISY, "There was an exception while processing Event [{}]", recordEvent, e); + LOG.atError() + .addMarker(EVENT) + .addMarker(NOISY) + .setMessage("There was an exception while processing Event [{}]") + .addArgument(recordEvent) + .setCause(e) + .log(); } } diff --git a/data-prepper-plugins/write-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/write_json/WriteJsonProcessor.java b/data-prepper-plugins/write-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/write_json/WriteJsonProcessor.java index 039f90e44e..51902aeb6d 100644 --- a/data-prepper-plugins/write-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/write_json/WriteJsonProcessor.java +++ b/data-prepper-plugins/write-json-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/write_json/WriteJsonProcessor.java @@ -53,7 +53,7 @@ public Collection> doExecute(Collection> records) { try { event.put(target, objectMapper.writeValueAsString(value)); } catch (Exception e) { - LOG.error(NOISY,"Failed to convert source to json string", e); + LOG.error(NOISY, "Failed to convert source to json string", e); writeJsonFailedCounter.increment(); } }