bash << 'EOF'
logtype="logtype_placeholder"
domain="domain_placeholder"
user=`/scripts/whoowns $domain`

echo -e "\e[1m \e[31m \nPlease be patient... It will take time to generate logs \n\n \e[0m"
if [[ $logtype == "cpaccess" ]]
then
 if stat --printf=''  /usr/local/cpanel/logs/archive/access* 2>/dev/null
 then
    zgrep -a $user  /usr/local/cpanel/logs/archive/access*|cut -d: -f2-
 else
    echo "No Archieved files found"
 fi
elif [[ $logtype == "ftp" ]]
then
 if stat --printf=''  /var/log/messages* 2>/dev/null
 then
   zgrep $user /var/log/messages* |cut -d: -f2-
 else
    echo "No Archieved files found"
 fi
elif [[ $logtype == "ssh" ]]
then
 if stat --printf=''  /var/log/secure* 2>/dev/null
 then
  zgrep $user /var/log/secure* |cut -d: -f2-
 else
    echo "No Archieved files found"
 fi
elif [[ $logtype = "loginlog" ]]
then
 if stat --printf='' /usr/local/cpanel/logs/archive/login_log* 2>/dev/null
 then
  zgrep $user /usr/local/cpanel/logs/archive/access*|cut -d: -f2-
 else
    echo "No Archieved files found"
 fi
elif [[ $logtype = "mail" ]]
then
 find /var/log/ -iname "exim_mainlog[.|-]*" -mtime -90 -exec sh -c "exigrep $domain {}|cat" \;
elif [[ $logtype = "mailaccess" ]]
then
 find /var/log/ -iname "maillog[.|-]*" -mtime -90 -exec zgrep $domain {} \;
fi
EOF