Remotely executed commands

Solution 1:

If what you need is actually an audit log then the bash history is not at all suitable anyway as that is removable/editable by the same user. (The bash history is essentially recorded for the benefit of that user so that they can reuse previous commands, etc.)

To get proper audit logging you would hook into the kernel with audit (on Linux, the same general idea would apply otherwise) and have it record the system events (command execution, file access, ...) that are relevant to your needs and store this log in a secure location (preferable on a different system entirely so that the audit logs are not lost in case of a compromised system).