Skip to content

Commit

Permalink
Simplify by redacting the value for client options
Browse files Browse the repository at this point in the history
  • Loading branch information
inqueue committed Jun 28, 2024
1 parent 095509d commit d93f7fe
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions esrally/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ def find_all_other_rally_processes() -> List[psutil.Process]:

def kill_all(predicate: Callable[[psutil.Process], bool]) -> None:
def kill(p: psutil.Process):
# Do not leak Elasticsearch authentication credentials to the log
# Redact client options as it contains sensitive information like passwords
p_cmdline = p.cmdline()
for i, s in enumerate(p_cmdline):
if "--client-options" in s:
p_cmdline[i] = re.sub(r"basic_auth_password:'.+'", "basic_auth_password:'*****'", s)
p_cmdline[i] = re.sub(r"api_key:'.+'", "api_key:'*****'", s)
p_cmdline[i] = "=".join((s.split("=")[0], '"*****"'))
logging.getLogger(__name__).info("Killing lingering process with PID [%s] and command line [%s].", p.pid, p_cmdline)
p.kill()
# wait until process has terminated, at most 3 seconds. Otherwise we might run into race conditions with actor system
Expand Down

0 comments on commit d93f7fe

Please sign in to comment.