Setup bash history to contain standard timestamps (RFC3339)

The bash history is an unintended form of documentation and also a way
to see what happened but by default it doesn't tell you when.

Before this change:
  $ history
      1  uname -a
      2  sudo reboot

After this change:
  $ history
      1  2017-12-20T23:50:28+0000 uname -a
      2  2017-12-20T23:50:35+0000 sudo reboot

Note that any entries in the bash history before this change will be
defaulted to when the change takes place.

Change-Id: I4443f00ab050891a16e545315ee88ae24893ac5d
This commit is contained in:
David Moreau Simard 2017-12-20 18:46:30 -05:00
parent 0c497852fa
commit 1afbd20db2
No known key found for this signature in database
GPG Key ID: 33A07694CBB71ECC
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1 @@
export HISTTIMEFORMAT="%Y-%m-%dT%T%z "

View File

@ -230,6 +230,15 @@ class openstack_project::server (
ensure => absent,
}
# Setup RFC3339 bash history timestamps
file { '/etc/profile.d/bash-history.sh':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/openstack_project/bash-history.sh',
}
if $::osfamily == 'Debian' {
# Ubuntu installs their whoopsie package by default, but it eats through
# memory and we don't need it on servers