You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VFS Transport Sender警告:SFTP文件修改时间设置失败配置咨询

解决VFS Transport Sender写入SFTP时的"无法设置最后修改时间"警告

问题原因

从警告日志的根因可明确:目标SFTP服务(此处为Azure Blob存储的SFTP端点)不支持修改文件最后修改时间的操作,底层jsch库返回UnsupportedOperation错误。该警告仅为VFS传输发送器尝试执行不支持的操作导致,不会影响文件写入的成功性,但会产生冗余日志。

解决方案

通过添加VFS传输参数禁用"设置最后修改时间"的操作,即可消除该警告,具体配置调整如下:

1. 修改SFTP端点URI

在两个send中介的endpoint URI中添加transport.vfs.disableSetLastModified=true参数,告知VFS Sender跳过设置文件最后修改时间的步骤。

修改后的端点示例:

<address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true&amp;transport.vfs.Streaming=true&amp;transport.vfs.disableSetLastModified=true;">

2. 精简冗余配置(可选)

每个target序列中重复设置了messageType属性,可删除重复项,精简后的序列片段示例:

<xslt key="sampleXSLT1"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="JSON1" expression="json-eval($)"/>
<property expression="fn:concat('abc','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>

修改后的完整Proxy配置

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="SampleProxy" startOnLoad="true" transports="http https vfs" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <inSequence>
            <smooks config-key="SmooksConf">
                <input type="text"/>
                <output type="xml"/>
            </smooks>
            <property expression="$body/*" name="Data" scope="default" type="OM"/>
            <clone sequential="true">
                <target>
                    <sequence>
                        <xslt key="sampleXSLT1"/>
                        <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
                        <property name="JSON1" expression="json-eval($)"/>
                        <property expression="fn:concat('abc','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
                        <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
                        <property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
                        <send>
                            <endpoint>
                                <address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true&amp;transport.vfs.Streaming=true&amp;transport.vfs.disableSetLastModified=true;">
                                    <suspendOnFailure>
                                        <initialDuration>-1</initialDuration>
                                        <progressionFactor>-1</progressionFactor>
                                        <maximumDuration>0</maximumDuration>
                                    </suspendOnFailure>
                                    <markForSuspension>
                                        <retriesBeforeSuspension>0</retriesBeforeSuspension>
                                    </markForSuspension>
                                </address>
                            </endpoint>
                        </send>
                    </sequence>
                </target>
                <target>
                    <sequence>
                        <xslt key="sampleXSLT2"/>
                        <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
                        <property name="JSON2" expression="json-eval($)"/>
                        <property expression="fn:concat('xyz','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
                        <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
                        <property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
                        <send>
                            <endpoint>
                                <address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true&amp;transport.vfs.Streaming=true&amp;transport.vfs.disableSetLastModified=true;">
                                    <suspendOnFailure>
                                        <initialDuration>-1</initialDuration>
                                        <progressionFactor>-1</progressionFactor>
                                        <maximumDuration>0</maximumDuration>
                                    </suspendOnFailure>
                                    <markForSuspension>
                                        <retriesBeforeSuspension>0</retriesBeforeSuspension>
                                    </markForSuspension>
                                </address>
                            </endpoint>
                        </send>
                    </sequence>
                </target>
            </clone>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </target>
    <parameter name="transport.vfs.Streaming">true</parameter>
    <parameter name="transport.PollInterval">15</parameter>
    <parameter name="transport.vfs.MaxRetryCount">1</parameter>
    <parameter name="transport.vfs.FileURI">sftp://{sftp_path}/input?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true</parameter>
    <parameter name="transport.vfs.ContentType">text/plain</parameter>
    <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
    <parameter name="transport.vfs.MoveAfterFailure">sftp://{sftp_path}/error?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true</parameter>
    <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
    <parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
    <parameter name="transport.vfs.MoveAfterProcess">sftp://{sftp_path}/move?sftpPathFromRoot=true&amp;transport.vfs.AvoidPermissionCheck=true</parameter>
</proxy>

验证效果

修改配置重启Proxy后,写入SFTP时将不再出现Could not set last modified的警告日志,文件写入功能保持正常。

内容的提问来源于stack exchange,提问作者stels

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 16:46:14