You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/02/28 04:26:42 UTC

[shardingsphere] branch master updated: add logging plugin e2e test for agent (#24339)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e4a9a46b895 add logging plugin e2e test for agent (#24339)
e4a9a46b895 is described below

commit e4a9a46b8951614538d6e7b62cf30ea4fa23748c
Author: jiangML <10...@qq.com>
AuthorDate: Tue Feb 28 12:26:34 2023 +0800

    add logging plugin e2e test for agent (#24339)
    
    * add agent logging e2e test
    
    * optimize code
    
    * add file plugin e2e test config
    
    * optimize code
    
    * add license for pom.xml
---
 .github/workflows/e2e-agent.yml                    |  30 ++++
 test/e2e/agent/plugins/logging/file/Dockerfile     |  28 ++++
 test/e2e/agent/plugins/logging/file/pom.xml        | 152 +++++++++++++++++++++
 .../test/e2e/agent/file/FilePluginE2EIT.java       |  48 +++++++
 .../test/e2e/agent/file/asserts/ContentAssert.java |  46 +++++++
 .../test/e2e/agent/file/loader/LogLoader.java      |  86 ++++++++++++
 .../test/resources/docker/agent/conf/agent.yaml    |  22 +++
 .../src/test/resources/docker/docker-compose.yml   |  50 +++++++
 .../resources/docker/proxy/conf/config-db.yaml     |  70 ++++++++++
 .../test/resources/docker/proxy/conf/server.yaml   |  30 ++++
 .../src/test/resources/env/engine-env.properties   |  25 ++++
 .../file/src/test/resources/env/mysql/init.sql     |  34 +++++
 test/e2e/agent/plugins/{ => logging}/pom.xml       |   8 +-
 test/e2e/agent/plugins/pom.xml                     |   1 +
 14 files changed, 625 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index 206d7dabae2..04363dce838 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -118,3 +118,33 @@ jobs:
       - name: Run E2E Test
         run: |
           ./mvnw -B clean install -f test/e2e/agent/plugins/metrics/${{ matrix.plugin }}/pom.xml -Dspotless.apply.skip=true -Dit.env.type=${{ matrix.plugin }} -Pit.env.${{ matrix.plugin }}
+
+  mysql-proxy-agent-logging:
+    name: Agent logging with MySQL
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        plugin: [ file ]
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: '11'
+      - uses: actions/cache@v3
+        with:
+          path: ~/.m2/repository
+          key: ${{ env.REPOSITORY_NAME }}-maven-third-party-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ env.REPOSITORY_NAME }}-maven-third-party-
+      - name: Build Project
+        run: |
+          ./mvnw -B clean install -DskipITs -DskipTests -Prelease
+      - name: Setup JDK 8 for Test
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: 8
+      - name: Run E2E Test
+        run: |
+          ./mvnw -B clean install -f test/e2e/agent/plugins/logging/${{ matrix.plugin }}/pom.xml -Dspotless.apply.skip=true -Dit.env.type=${{ matrix.plugin }} -Pit.env.${{ matrix.plugin }}
diff --git a/test/e2e/agent/plugins/logging/file/Dockerfile b/test/e2e/agent/plugins/logging/file/Dockerfile
new file mode 100644
index 00000000000..8019795ff49
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/Dockerfile
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM eclipse-temurin:8-jdk
+
+ARG APP_NAME
+ENV WAIT_VERSION 2.7.2
+
+ADD target/${APP_NAME}.tar.gz /opt
+ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
+RUN chmod +x /wait
+RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy
+RUN wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar -P /opt/shardingsphere-proxy/lib
+ENTRYPOINT /wait && /opt/shardingsphere-proxy/bin/start.sh -g && tail -f /opt/shardingsphere-proxy/logs/stdout.log
diff --git a/test/e2e/agent/plugins/logging/file/pom.xml b/test/e2e/agent/plugins/logging/file/pom.xml
new file mode 100644
index 00000000000..19b40b5bd3c
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/pom.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.shardingsphere</groupId>
+        <artifactId>shardingsphere-test-e2e-agent-plugins-logging</artifactId>
+        <version>5.3.2-SNAPSHOT</version>
+    </parent>
+    <artifactId>shardingsphere-test-e2e-agent-plugins-logging-file</artifactId>
+    <name>${project.artifactId}</name>
+    
+    <properties>
+        <maven.deploy.skip>true</maven.deploy.skip>
+        <mysql-connector-java.version>8.0.31</mysql-connector-java.version>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-test-e2e-agent-plugins-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+        </dependency>
+        
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>${mysql-connector-java.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.zaxxer</groupId>
+            <artifactId>HikariCP</artifactId>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>integration-tests</id>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <profiles>
+        <profile>
+            <id>it.env.file</id>
+            <properties>
+                <it.env>file</it.env>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>copy-resources</id>
+                                <goals>
+                                    <goal>copy-resources</goal>
+                                </goals>
+                                <phase>validate</phase>
+                                <configuration>
+                                    <outputDirectory>target/</outputDirectory>
+                                    <resources>
+                                        <resource>
+                                            <directory>${project.basedir}/../../../../../../distribution/proxy/target/</directory>
+                                        </resource>
+                                    </resources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>dockerfile-maven-plugin</artifactId>
+                        <configuration>
+                            <repository>apache/shardingsphere-proxy-agent-logging-file-test</repository>
+                            <tag>${project.version}</tag>
+                            <tag>latest</tag>
+                            <buildArgs>
+                                <APP_NAME>${docker.distribution.name}</APP_NAME>
+                            </buildArgs>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>shardingsphere-proxy-bin</id>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.dkanejs.maven.plugins</groupId>
+                        <artifactId>docker-compose-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>agent-metrics-up</id>
+                                <goals>
+                                    <goal>up</goal>
+                                </goals>
+                                <phase>pre-integration-test</phase>
+                                <configuration>
+                                    <composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+                                    <detachedMode>true</detachedMode>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>agent-metrics-down</id>
+                                <goals>
+                                    <goal>down</goal>
+                                </goals>
+                                <phase>post-integration-test</phase>
+                                <configuration>
+                                    <composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+                                    <removeVolumes>true</removeVolumes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
new file mode 100644
index 00000000000..7fd1132d37b
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.e2e.agent.file;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.BasePluginE2EIT;
+import org.apache.shardingsphere.test.e2e.agent.file.asserts.ContentAssert;
+import org.apache.shardingsphere.test.e2e.agent.file.loader.LogLoader;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import static org.junit.Assert.assertTrue;
+
+public final class FilePluginE2EIT extends BasePluginE2EIT {
+    
+    @SneakyThrows(IOException.class)
+    @Test
+    public void assertProxyWithAgent() {
+        super.assertProxyWithAgent();
+        assertTrue(String.format("The file `%s` does not exist", LogLoader.getLogFilePath()), LogLoader.getLogFile().exists());
+        Collection<String> expectedLogRegexs = getExpectedLogRegex();
+        expectedLogRegexs.forEach(ContentAssert::assertIs);
+    }
+    
+    private Collection<String> getExpectedLogRegex() {
+        Collection<String> result = new LinkedList<>();
+        result.add("Build meta data contexts finished, cost [1-9]* milliseconds");
+        return result;
+    }
+}
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java
new file mode 100644
index 00000000000..fa5465de1b4
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.e2e.agent.file.asserts;
+
+import org.apache.shardingsphere.test.e2e.agent.file.loader.LogLoader;
+
+import java.util.Collection;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+
+/**
+ * Content assert.
+ */
+public final class ContentAssert {
+    
+    /**
+     * Assertion specifies regular log content.
+     *
+     * @param expectedLogRegex expected log regex
+     */
+    public static void assertIs(final String expectedLogRegex) {
+        Collection<String> actualLogLines = LogLoader.getLogLines();
+        assertThat(String.format("Actual log is empty"), actualLogLines.size(), greaterThan(0));
+        Pattern pattern = Pattern.compile(expectedLogRegex);
+        Collection<String> expectedLogs = actualLogLines.stream().filter(each -> pattern.matcher(each).find()).collect(Collectors.toList());
+        assertThat(String.format("The log for the specified regular `%s` does not exist", expectedLogRegex), expectedLogs.size(), greaterThan(0));
+    }
+}
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java
new file mode 100644
index 00000000000..a662bb59721
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.e2e.agent.file.loader;
+
+import lombok.SneakyThrows;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Log loader.
+ */
+public final class LogLoader {
+    
+    /**
+     * Get log lines.
+     *
+     * @return log lines
+     */
+    @SneakyThrows(IOException.class)
+    public static Collection<String> getLogLines() {
+        Collection<String> result = new LinkedList<>();
+        Collection<String> lines = Files.readAllLines(Paths.get(getLogFilePath()));
+        Pattern pattern = Pattern.compile("^\\[");
+        StringBuilder builder = new StringBuilder();
+        boolean hasFind = false;
+        for (String each : lines) {
+            Matcher matcher = pattern.matcher(each);
+            if (matcher.find()) {
+                if (hasFind) {
+                    result.add(builder.toString());
+                    builder.delete(0, builder.length());
+                }
+                builder.append(each);
+                hasFind = true;
+                continue;
+            }
+            if (hasFind) {
+                builder.append(each);
+            }
+        }
+        if (builder.length() > 0) {
+            result.add(builder.toString());
+        }
+        return result;
+    }
+    
+    /**
+     * Get log file path.
+     *
+     * @return log file path
+     */
+    public static String getLogFilePath() {
+        return String.join(File.separator, System.getProperty("user.dir"), "target", "logs", "stdout.log");
+    }
+    
+    /**
+     * Get log file.
+     *
+     * @return log file
+     */
+    public static File getLogFile() {
+        return new File(getLogFilePath());
+    }
+}
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/agent/conf/agent.yaml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/agent/conf/agent.yaml
new file mode 100644
index 00000000000..02648ba5226
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/agent/conf/agent.yaml
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+plugins:
+  logging:
+    File:
+      props:
+        level: "INFO"
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/docker-compose.yml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/docker-compose.yml
new file mode 100644
index 00000000000..9fe1eaa4065
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/docker-compose.yml
@@ -0,0 +1,50 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+version: "2.1"
+
+services:
+  mysql:
+    image: "mysql/mysql-server:5.7"
+    container_name: agent-logging-mysql
+    command: ['--sql_mode=', '--default-authentication-plugin=mysql_native_password']
+    volumes:
+      - ../env/mysql:/docker-entrypoint-initdb.d/
+    ports:
+      - "43060:3306"
+    environment:
+      - LANG=C.UTF-8
+
+  shardingsphere-proxy-agent-logging:
+    image: apache/shardingsphere-proxy-agent-logging-file-test
+    container_name: shardingsphere-proxy-agent-logging-file
+    ports:
+      - "43072:3307"
+      - "43080:3308"
+    links:
+      - "mysql:mysql.agent.logging.host"
+    volumes:
+      - ./proxy/conf:/opt/shardingsphere-proxy/conf
+      - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
+      - ../../../../target/logs:/opt/shardingsphere-proxy/logs
+    depends_on:
+      - mysql
+    environment:
+      - WAIT_HOSTS=mysql:3306
+      - WAIT_HOSTS_TIMEOUT=300
+      - WAIT_SLEEP_INTERVAL=5
+      - WAIT_HOST_CONNECT_TIMEOUT=30
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/config-db.yaml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/config-db.yaml
new file mode 100644
index 00000000000..b601248abc0
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+databaseName: agent-file-db
+
+dataSources:
+  ds_0:
+    url: jdbc:mysql://mysql.agent.logging.host:3306/agent_file_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: root
+    password:
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 10
+    minPoolSize: 2
+  ds_1:
+    url: jdbc:mysql://mysql.agent.logging.host:3306/agent_file_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: root
+    password:
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 10
+    minPoolSize: 2
+
+rules:
+  - !SHARDING
+    tables:
+      t_order:
+        actualDataNodes: ds_${0..1}.t_order_${0..1}
+        tableStrategy:
+          standard:
+            shardingColumn: order_id
+            shardingAlgorithmName: t_order_inline
+        keyGenerateStrategy:
+          column: order_id
+          keyGeneratorName: snowflake
+    defaultDatabaseStrategy:
+      standard:
+        shardingColumn: user_id
+        shardingAlgorithmName: database_inline
+    defaultTableStrategy:
+      none:
+    shardingAlgorithms:
+      database_inline:
+        type: INLINE
+        props:
+          algorithm-expression: ds_${user_id % 2}
+      t_order_inline:
+        type: INLINE
+        props:
+          algorithm-expression: t_order_${order_id % 2}
+
+    keyGenerators:
+      snowflake:
+        type: SNOWFLAKE
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/server.yaml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/server.yaml
new file mode 100644
index 00000000000..5108e6a4a05
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/proxy/conf/server.yaml
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+authority:
+  users:
+    - user: root
+      password: root
+  privilege:
+    type: ALL_PERMITTED
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  proxy-hint-enabled: false
+  sql-show: true
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties b/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties
new file mode 100644
index 00000000000..10fcecc9529
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+it.env.type=${it.env}
+it.env.value=file
+
+proxy.url=jdbc:mysql://127.0.0.1:43072/agent-file-db?serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8
+proxy.username=root
+proxy.password=root
+
+collect.data.wait.milliseconds=2000
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/env/mysql/init.sql b/test/e2e/agent/plugins/logging/file/src/test/resources/env/mysql/init.sql
new file mode 100644
index 00000000000..6cbc0e1e555
--- /dev/null
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/env/mysql/init.sql
@@ -0,0 +1,34 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS agent_file_db_0;
+DROP DATABASE IF EXISTS agent_file_db_1;
+
+CREATE DATABASE agent_file_db_0;
+CREATE DATABASE agent_file_db_1;
+
+CREATE TABLE agent_file_db_0.t_order_0 (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE agent_file_db_0.t_order_1 (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+
+CREATE TABLE agent_file_db_1.t_order_0 (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE agent_file_db_1.t_order_1 (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
diff --git a/test/e2e/agent/plugins/pom.xml b/test/e2e/agent/plugins/logging/pom.xml
similarity index 85%
copy from test/e2e/agent/plugins/pom.xml
copy to test/e2e/agent/plugins/logging/pom.xml
index 07b2e6c9e39..67f3458ec5d 100644
--- a/test/e2e/agent/plugins/pom.xml
+++ b/test/e2e/agent/plugins/logging/pom.xml
@@ -21,16 +21,14 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-test-e2e-agent</artifactId>
+        <artifactId>shardingsphere-test-e2e-agent-plugins</artifactId>
         <version>5.3.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-test-e2e-agent-plugins</artifactId>
+    <artifactId>shardingsphere-test-e2e-agent-plugins-logging</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>common</module>
-        <module>metrics</module>
-        <module>tracing</module>
+        <module>file</module>
     </modules>
 </project>
diff --git a/test/e2e/agent/plugins/pom.xml b/test/e2e/agent/plugins/pom.xml
index 07b2e6c9e39..5196d9f1d05 100644
--- a/test/e2e/agent/plugins/pom.xml
+++ b/test/e2e/agent/plugins/pom.xml
@@ -32,5 +32,6 @@
         <module>common</module>
         <module>metrics</module>
         <module>tracing</module>
+        <module>logging</module>
     </modules>
 </project>