2016-06-20 3 views
0

私はイベント入力が少し異なるので、カスタム入力マッピングを持つイベント受信機を持っています。メタ属性や相関属性はありません。 例は次のとおりです。カスタム入力マッピングJSON:JSONPathで受信イベントの一致を見つけることができません

{ "ts":"2016-05-08T08:59:47.363764Z", 
    "uid":"CLuCgz3HHzG7LpLwH9", 
    "id.orig_h":"172.30.26.119", 
    "id.orig_p":51976, 
    "id.resp_h":"172.30.26.160", 
    "id.resp_p":22, 
    "version":2, 
    "client":"SSH-2.0-OpenSSH_5.0", 
    "server":"SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6", 
    "cipher_alg":"arcfour256", 
    "mac_alg":"hmac-md5", 
    "compression_alg":"none", 
    "kex_alg":"diffie-hellman-group-exchange-sha1", 
    "host_key_alg":"ssh-rsa", 
    "host_key":"8d:df:71:ac:29:1f:67:6f:f3:dd:c3:e5:2e:5f:3e:b4"} 

何の改行はありませんが、私はそれを読みやすくするために追加されました。そこで私は、カスタム入力マッピングとイベントレシーバーを作成しました:

<?xml version="1.0" encoding="UTF-8"?> 
<eventReceiver name="sshlogreceiver" statistics="disable" 
trace="disable" xmlns="http://wso2.org/carbon/eventreceiver"> 
<from eventAdapterType="http"> 
    <property name="transports">all</property> 
</from> 
<mapping customMapping="enable" type="json"> 
    <property> 
     <from jsonPath="$.ts"/> 
     <to name="ts" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.uid"/> 
     <to name="uid" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.id.orig_h"/> 
     <to name="id_orig_h" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.id.orig_p"/> 
     <to name="id_orig_p" type="int"/> 
    </property> 
    <property> 
     <from jsonPath="$.id.resp_h"/> 
     <to name="id_resp_h" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.id.resp_p"/> 
     <to name="id_resp_p" type="int"/> 
    </property> 
    <property> 
     <from jsonPath="$.version"/> 
     <to name="version" type="int"/> 
    </property> 
    <property> 
     <from jsonPath="$.client"/> 
     <to name="client" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.server"/> 
     <to name="server" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.cipher_alg"/> 
     <to name="cipher_alg" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.mac_alg"/> 
     <to name="mac_alg" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.compression_alg"/> 
     <to name="compression_alg" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.kex_alg"/> 
     <to name="kex_alg" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.host_key_alg"/> 
     <to name="host_key_alg" type="string"/> 
    </property> 
    <property> 
     <from jsonPath="$.host_key"/> 
     <to name="host_key" type="string"/> 
    </property> 
</mapping> 
<to streamName="SSHInStream" version="1.0.0"/> 
</eventReceiver> 

入力ストリームのサンプルイベントは次のとおりです。

{ 
"event": { 
    "payloadData": { 
     "ts": "data5", 
     "uid": "data5", 
     "id_orig_h": "data1", 
     "id_orig_p": 70, 
     "id_resp_h": "data3", 
     "id_resp_p": 4, 
     "version": 50, 
     "client": "data1", 
     "server": "data2", 
     "cipher_alg": "data5", 
     "mac_alg": "data3", 
     "compression_alg": "data3", 
     "kex_alg": "data4", 
     "host_key_alg": "data4", 
     "host_key": "data4" 
    } 
} 
} 

私はそれは、単純なログであるように私のイベントにeventと​​タグを持っていけませんファイル。

ERRORが

{org.wso2.carbon.event.receiver.core.internal.type.json.JSONInputMapper} - Could not find any matches for the incoming event with JSONPath : [email protected] ,hence dropping the event 

私が間違っカスタム入力マッピングを行っているか、私がする必要がある他に何?私はイベントを送信しようとすると、私は言ってコンソールにエラーが発生しましたか

答えて

0

エラーの原因は、イベントのパラメータにドット(。)があるためです。私が他のキャラクターとそれらを交換するとすぐに、私はアンダースコアを選んだ、それは正常に働いた。

関連する問題