diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc
index 0d09cdcd36e..84237026ed0 100644
--- a/mysql-test/include/search_pattern_in_file.inc
+++ b/mysql-test/include/search_pattern_in_file.inc
@@ -60,12 +60,12 @@
 
 perl;
     use strict;
-    my $search_file=           $ENV{'SEARCH_FILE'}           or die "SEARCH_FILE not set";
-    my $search_pattern=        $ENV{'SEARCH_PATTERN'}        or die "SEARCH_PATTERN not set";
-    my $search_range=          $ENV{'SEARCH_RANGE'};
+    my $search_file=    $ENV{'SEARCH_FILE'}    or die "SEARCH_FILE not set";
+    my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set";
+    my $search_range=   $ENV{'SEARCH_RANGE'};
     my $file_content;
     $search_range= 50000 unless $search_range =~ /-?[0-9]+/;
-    open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n");
+    open(FILE, '<', $search_file) or die("Unable to open '$search_file': $!\n");
     if ($search_range >= 0) {
        read(FILE, $file_content, $search_range, 0);
     } else {
@@ -75,7 +75,10 @@ perl;
        read(FILE, $file_content, -$search_range, 0);
     }
     close(FILE);
-    if ( not $file_content =~ m{$search_pattern} ) {
-       die("# ERROR: The file '$search_file' does not contain the expected pattern  $search_pattern\n->$file_content<-\n");
+    $search_file =~ s{^.*?([^/\\]+)$}{$1};
+    if ($file_content =~ m{$search_pattern}) {
+      print "FOUND /$search_pattern/ in $search_file\n"
+    } else {
+      print "NOT FOUND /$search_pattern/ in $search_file\n"
     }
 EOF
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 083ed9686d4..abb9c6240d3 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5395,6 +5395,7 @@ DROP FUNCTION f1;
 DROP VIEW v1;
 DROP TABLE t1, t2;
 create view v1 as select 1;
+FOUND /mariadb-version/ in v1.frm
 drop view v1;
 #
 # MDEV-7260: Crash in get_best_combination when executing multi-table
diff --git a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result b/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result
index cc2a0373444..07e13008e27 100644
--- a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result
+++ b/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result
@@ -33,6 +33,7 @@ INSERT INTO t1 VALUES(1,'X',1);
 SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace';
 SELECT b FROM t1 LIMIT 3;
 ERROR HY000: Lost connection to MySQL server during query
+FOUND /Wrote log record for ibuf update in place operation/ in my_restart.err
 CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
diff --git a/mysql-test/suite/plugins/r/filekeys_encfile_bad.result b/mysql-test/suite/plugins/r/filekeys_encfile_bad.result
index 5345abf50fd..6261bd459b8 100644
--- a/mysql-test/suite/plugins/r/filekeys_encfile_bad.result
+++ b/mysql-test/suite/plugins/r/filekeys_encfile_bad.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("Cannot decrypt .*filekeys-data.enc. Wrong key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Cannot decrypt .*filekeys-data.enc. Wrong key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/plugins/r/filekeys_encfile_badfile.result b/mysql-test/suite/plugins/r/filekeys_encfile_badfile.result
index dfeeb24a024..98e2266f3f2 100644
--- a/mysql-test/suite/plugins/r/filekeys_encfile_badfile.result
+++ b/mysql-test/suite/plugins/r/filekeys_encfile_badfile.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("File 'bad' not found");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /File 'bad' not found/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/plugins/r/filekeys_encfile_no.result b/mysql-test/suite/plugins/r/filekeys_encfile_no.result
index 5345abf50fd..6261bd459b8 100644
--- a/mysql-test/suite/plugins/r/filekeys_encfile_no.result
+++ b/mysql-test/suite/plugins/r/filekeys_encfile_no.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("Cannot decrypt .*filekeys-data.enc. Wrong key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Cannot decrypt .*filekeys-data.enc. Wrong key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/plugins/r/filekeys_nofile.result b/mysql-test/suite/plugins/r/filekeys_nofile.result
index b77c663e848..558ea1ce88c 100644
--- a/mysql-test/suite/plugins/r/filekeys_nofile.result
+++ b/mysql-test/suite/plugins/r/filekeys_nofile.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("File '' not found");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /File '' not found/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/plugins/r/filekeys_syntax.result b/mysql-test/suite/plugins/r/filekeys_syntax.result
index 245dab5aca7..a5606152d80 100644
--- a/mysql-test/suite/plugins/r/filekeys_syntax.result
+++ b/mysql-test/suite/plugins/r/filekeys_syntax.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("File '.*keys.txt' not found");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /File '.*keys.txt' not found/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -11,6 +12,7 @@ ERROR HY000: Invalid key id at MYSQL_TMP_DIR/keys.txt line 2, column 2
 call mtr.add_suppression("File '.*keys.txt' not found");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /File '.*keys.txt' not found/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -19,6 +21,7 @@ plugin_status
 call mtr.add_suppression("Invalid key id");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key id/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -29,6 +32,7 @@ ERROR HY000: Invalid key id at MYSQL_TMP_DIR/keys.txt line 2, column 11
 call mtr.add_suppression("Invalid key id");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key id/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -37,6 +41,7 @@ plugin_status
 call mtr.add_suppression("Invalid key id");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key id/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -47,6 +52,7 @@ ERROR HY000: Invalid key at MYSQL_TMP_DIR/keys.txt line 2, column 47
 call mtr.add_suppression("Invalid key id");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key id/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -55,6 +61,7 @@ plugin_status
 call mtr.add_suppression("Invalid key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -65,6 +72,7 @@ ERROR HY000: Invalid key at MYSQL_TMP_DIR/keys.txt line 2, column 33
 call mtr.add_suppression("Invalid key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -73,6 +81,7 @@ plugin_status
 call mtr.add_suppression("Invalid key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -83,6 +92,7 @@ ERROR HY000: Syntax error at MYSQL_TMP_DIR/keys.txt line 2, column 2
 call mtr.add_suppression("Invalid key");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Invalid key/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -91,6 +101,7 @@ plugin_status
 call mtr.add_suppression("Syntax error");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Syntax error/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -101,6 +112,7 @@ ERROR HY000: Syntax error at MYSQL_TMP_DIR/keys.txt line 2, column 1
 call mtr.add_suppression("Syntax error");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Syntax error/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
@@ -109,6 +121,7 @@ plugin_status
 call mtr.add_suppression("Syntax error");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Syntax error/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/plugins/r/filekeys_unencfile.result b/mysql-test/suite/plugins/r/filekeys_unencfile.result
index 39547b01f14..1b9c092a713 100644
--- a/mysql-test/suite/plugins/r/filekeys_unencfile.result
+++ b/mysql-test/suite/plugins/r/filekeys_unencfile.result
@@ -1,6 +1,7 @@
 call mtr.add_suppression("Cannot decrypt .*keys.txt. Not encrypted");
 call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
 call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
+FOUND /Cannot decrypt .*keys.txt. Not encrypted/ in mysqld.1.err
 create table t1(c1 bigint not null, b char(200))  engine=innodb encrypted=yes encryption_key_id=1;
 ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
 select plugin_status from information_schema.plugins
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index 231afeec4b2..3f9c780ed67 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -143,6 +143,7 @@ SET debug_dbug= @old_dbug;
 INSERT INTO t4 VALUES (2);
 include/wait_for_slave_sql_error.inc [errno=1590]
 Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: error writing to the binary log'
+FOUND /Slave SQL: The incident LOST_EVENTS occured on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590/ in mysqld.2.err
 SELECT * FROM t4 ORDER BY a;
 a
 1
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
index 204615201d9..ab615d0510a 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
@@ -38,5 +38,7 @@ a
 3
 4
 5
+FOUND /Slave SQL: Error 'Duplicate entry .* on query\. .*Query: '.*', Gtid 0-1-100, Internal MariaDB error code:|Slave SQL: Could not execute Write_rows.*table test.t1; Duplicate entry.*, Gtid 0-1-100, Internal MariaDB error/ in mysqld.2.err
+FOUND /Slave SQL: The incident LOST_EVENTS occured on the master\. Message: <none>, Internal MariaDB error code: 1590/ in mysqld.2.err
 DROP TABLE t1;
 include/rpl_end.inc