如何更改 cqlsh (cqlsh_history) 日志文件位置?

How can I change the cqlsh (cqlsh_history) log file location?

cqlsh 当前将命令记录到 ~/.cassandra/cqlsh_history 将其更改为 /var/log/cqlsh

真的很方便

我猜有一个可选的 cqlsh 日志记录配置文件。我无法在任何地方找到它的记录。 有人知道这件事吗?

我认为不对 cqlsh.py 文件进行一些更改是不可能的。

来自cqlsh.py

HISTORY_DIR = os.path.expanduser(os.path.join('~', '.cassandra'))
// ...
HISTORY = os.path.join(HISTORY_DIR, 'cqlsh_history')

感谢之前的回答,我刚刚更新了 cqlsh.py 中的历史目录 还将用户的登录名添加到文件名中。 请注意,普通用户将无法创建日志目录,因此它不存在,您需要恢复为默认值。

HISTORY_DIR = '/var/log/cql'
HISTORY_FILE = os.getlogin() + "_cqlsh_history"

#fall back to ~/ if central log dir is missing
if not os.path.exists(HISTORY_DIR):
    HISTORY_DIR = os.path.expanduser(os.path.join('~', '.cassandra'))

HISTORY = os.path.join(HISTORY_DIR, HISTORY_FILE)