Page 1 of 1

Bash History

Posted: Thu Dec 01, 2022 3:15 pm
by nagnerd
Is it possible to send a users bash history to log server as a log file

Re: Bash History

Posted: Tue Jun 20, 2023 10:17 am
by weevessels
I think not. I tried and it gives error

Re: Bash History

Posted: Tue Jun 20, 2023 1:41 pm
by bv406
nagnerd wrote: Thu Dec 01, 2022 3:15 pm Is it possible to send a users bash history to log server as a log file
Did some research and found some information pertaining to this subject.

It is possible to send a user's bash history to a log server as a log file in Nagios Log Server. However, this requires configuring the bash shell to log the history to a file, and then configuring the log server to collect the log file. One way to configure bash to log history to a file is to add the following lines to the .bashrc file:

Code: Select all

# Log history to file
export HISTTIMEFORMAT="%F %T "
export PROMPT_COMMAND='history -a >(tee -a ~/.bash_history | logger -t "bash[$$]")'
This will log the history to the ~/.bash_history file and also send it to the syslog daemon, which can then be collected by Nagios Log Server.

Once the bash history is being logged to a file, Nagios Log Server can be configured to collect the log file using the appropriate protocol (TCP, UDP, or TLS/SSL) and port. The IP address and port of the Nagios Log Server instance can be found in the Configuration Editor section of the Configure page