Bash History

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Post Reply
nagnerd
Posts: 7
Joined: Thu Nov 17, 2022 10:10 am

Bash History

Post by nagnerd »

Is it possible to send a users bash history to log server as a log file
weevessels
Posts: 4
Joined: Tue Jun 20, 2023 10:09 am
Contact:

Re: Bash History

Post by weevessels »

I think not. I tried and it gives error
bv406
Posts: 31
Joined: Tue Apr 11, 2023 11:45 am

Re: Bash History

Post 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
Post Reply