diff --git a/tasks/configure_processing_user.yml b/tasks/configure_processing_user.yml
index a7dc2215556856b70eaf11af99c46e7ab9c82fcd..e1022d236172559a0522ca79efa2d1a98ec5f3aa 100644
--- a/tasks/configure_processing_user.yml
+++ b/tasks/configure_processing_user.yml
@@ -22,6 +22,31 @@
     marker: "# {mark} ANSIBLE MANAGED BLOCK - SubApp-specific"
     state: present
     block: |
+      ta_get_error_mails() (
+        if [[ $1 != "" ]]; then YEAR="$1"
+        else YEAR="$( date +%Y )"
+        fi
+        LOG="/var/log/subapp/$(hostname)/staff_mails.log"
+        ( if [ -e ${LOG} ]; then
+            cat ${LOG}
+          fi
+          if compgen -G "${LOG}.*.lz" > /dev/null; then
+            lzip -cd "${LOG}.*.lz"
+          fi
+          if compgen -G "${LOG}.*.gz" > /dev/null; then
+            zcat "${LOG}.*.gz"
+          fi
+        ) | grep "\[$YEAR" | grep -o "slub\.lza\.staff.*"
+      )
+
+      ta_get_error_mail_count_all() (
+          ta_get_error_mails $1 | wc -l
+      )
+
+      ta_get_error_mail_count_dedup() (
+          ta_get_error_mails $1 | sort | uniq | wc -l
+      )
+
       cd ~
 
 - name: Add aliases for SubApp user