 proc counterrors {pattern logs} {
   set errorcount 0
   foreach line [split $logs "\n"] {
+    if { [regexp "/var/log/messages" $line] } {
+      continue
+    }
     if { [regexp $pattern $line] } {
       incr errorcount 1
     }

    spawn telnet $host

    expect timeout {
      send_user "$host: CONNECTION ERROR - connection timeout\n"
      continue
    } eof {
      send_user "$host: CONNECTION ERROR - got eof\n"
      continue
    } "Login incorrect" {
      send_user "$host: CONNECTION ERROR - wrong credentials\n"
      continue
    } "Permission denied, please try again." {
      send_user "$host: CONNECTION ERROR - wrong credentials\n"
      continue 
    } "Are you sure you want to continue connecting (yes/no)?" {
      send -s "yes\r"

        expect "*% " {send -s "exit\r"}
      }
    }
    send_user "\n#### $host in total has $errorperhost errors ####\n"
    expect "*> " { send -s "exit\r"}
  }
}
