Skip to content

Commit

Permalink
Remove user data from logs when not in debug/trace mode
Browse files Browse the repository at this point in the history
Signed-off-by: Mohit Godwani <[email protected]>
  • Loading branch information
mgodwan committed Jan 13, 2025
1 parent 8d5e1a3 commit 5443075
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ public void execute() throws Exception {
finishAsFailed(
new UnavailableShardsException(
primaryId,
"{} Timeout: [{}], request: [{}]",
"{} Timeout: [{}]",
activeShardCountFailure,
request.timeout(),
request
request.timeout()
)
);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ void finishOnSuccess(Response response) {
}

void retryBecauseUnavailable(ShardId shardId, String message) {
retry(new UnavailableShardsException(shardId, "{} Timeout: [{}], request: [{}]", message, request.timeout(), request));
retry(new UnavailableShardsException(shardId, "{} Timeout: [{}]", message, request.timeout()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.opensearch.index.shard.IndexShard;
import org.opensearch.script.Script;
import org.opensearch.script.ScriptService;
import org.opensearch.script.ScriptType;
import org.opensearch.script.UpdateScript;
import org.opensearch.search.lookup.SourceLookup;

Expand Down Expand Up @@ -128,7 +129,11 @@ Tuple<UpdateOpType, Map<String, Object>> executeScriptedUpsert(Map<String, Objec

if (operation != UpdateOpType.CREATE && operation != UpdateOpType.NONE) {
// Only valid options for an upsert script are "create" (the default) or "none", meaning abort upsert
logger.warn("Invalid upsert operation [{}] for script [{}], doing nothing...", operation, script.getIdOrCode());
if (logger.isDebugEnabled() || ScriptType.STORED.equals(script.getType())) {
logger.warn("Invalid upsert operation [{}] for script [{}], doing nothing...", operation, script.getIdOrCode());
} else {
logger.warn("Invalid upsert operation [{}] for given script", operation);
}
operation = UpdateOpType.NONE;
}

Expand Down

0 comments on commit 5443075

Please sign in to comment.