Your logic looks very much like you need to discover the case statement.
tail -n 0 -F hive-server2.log | # No backslash necessary here
tr A-Z a-z | # Convert to lower case
while read -r line # -r option; lowercase variable
do
case $line in
*'select '*)
AuditTypeID=15
QueryResult="$(grep -oEi 'SELECT .*' hive-server2.log | sed -n \$p)";;
*create*)
AuditTypeID=13
QueryResult="$(grep -oEi 'CREATE EXTERNAL TABLE [a-zA-Z][a-zA-Z0-9_]*' hive-server2.log | sed -n \$p)";;
done
The antipattern if [ $(echo "blah" | grep -c something) -gt 0 ] is common but very unidiomatic (see useless use of grep); the way to check if grep matched something is just if echo "blah" | grep -q something but here, you can obviously use the shell's built-in pattern-matching facilities to simplify even further.
Uppercase variable names are reserved for system use; I recommend lower or mixed case for all your script's private variables.
Your code might still have other bugs (rereading the entire file to find the latest create or select statement very much looks like something you should probably refactor) but the immediate problem seems to be that you are matching a lowercase string against an uppercase pattern. The code above folds the input to lower case, which is an easy fix as such, but not always a desirable workaround (perhaps you want to see the original line, not the case-folded version, in the output?). Bash 4.x provides a simple facility for case-folding so you could say case ${line,,} and remove the tr.
tail-ing from a file to read lines.*in the first grep pattern is redundant.tail -n 0, which means take the last zero lines from the log file, i.e. nothing is piped into the loop and the first read fails already. If you really observe the behaviour that the elif part is executed, it can't be from this script. BTW, combining the-nand-Foption doesn't make sense.