Add timestamp to bash history

Fixes-bug: PROD-34603
Change-Id: I908195f4484eabf4bde622ba59ef5fcd5e361187
diff --git a/README.rst b/README.rst
index 9a9b344..1d9cb23 100644
--- a/README.rst
+++ b/README.rst
@@ -282,6 +282,27 @@
           name: cfq
         ...
 
+Set timestamp format to bash history
+Default value
+  bash_history_timestamp: '%d/%m/%y %T'
+
+  - %d     day of month (e.g., 01)
+  - %m     month (01..12)
+  - %y     last two digits of year (00..99)
+  - %T     time; same as %H:%M:%S
+
+All available parameters you can find by 'man date'
+
+.. code-block:: yaml
+
+    linux:
+      system:
+        ...
+        shell:
+          bash_history_timestamp: '%d/%m/%y %T'
+        ...
+
+
 Linux with package, latest version:
 
 .. code-block:: yaml
diff --git a/linux/system/shell.sls b/linux/system/shell.sls
index 29fc1dc..f3a9218 100644
--- a/linux/system/shell.sls
+++ b/linux/system/shell.sls
@@ -41,5 +41,25 @@
     - append_if_not_found: True
     - onlyif: test -f /etc/profile
     {%- endif %}
+
+etc_bash_bashrc_timestamp:
+  file.blockreplace:
+    - name: /etc/bash.bashrc
+    - marker_start: "# BEGIN set timestamp to bash history"
+    - marker_end: "# END set timestamp to bash history"
+    - content: export HISTTIMEFORMAT="{{ system.shell.get('bash_history_timestamp','%d/%m/%y %T') }} "
+    - append_if_not_found: True
+    - onlyif: test -f /etc/bash.bashrc
+
+etc_profile_timestamp:
+  file.blockreplace:
+    - name: /etc/profile
+    - marker_start: "# BEGIN set timestamp to bash history"
+    - marker_end: "# END set timestamp to bash history"
+    - content: export HISTTIMEFORMAT="{{ system.shell.get('bash_history_timestamp','%d/%m/%y %T') }} "
+    - append_if_not_found: True
+    - onlyif: test -f /etc/profile
+
+
   {%- endif %}
 {%- endif %}