Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid logging ES credentials from running Rally processes #1863

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion esrally/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,19 @@ def find_all_other_rally_processes() -> List[psutil.Process]:
return others


def redact_cmdline(cmdline: list) -> List[str]:
"""
Redact client options in cmdline as it contains sensitive information like passwords
"""

return ["=".join((value.split("=")[0], '"*****"')) if "--client-options" in value else value for value in cmdline]


def kill_all(predicate: Callable[[psutil.Process], bool]) -> None:
def kill(p: psutil.Process):
logging.getLogger(__name__).info("Killing lingering process with PID [%s] and command line [%s].", p.pid, p.cmdline())
logging.getLogger(__name__).info(
"Killing lingering process with PID [%s] and command line [%s].", p.pid, redact_cmdline(p.cmdline())
)
p.kill()
# wait until process has terminated, at most 3 seconds. Otherwise we might run into race conditions with actor system
# sockets that are still open.
Expand Down
Loading