compose(関数1,関数2, ...)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
可変引数、関数 | パラメータは戻り値の型がLOGである関数でなければなりません。 | 関数式 | 少なくとも1つの関数パラメータ | - | - |
{"status": "500"}
//1. enrich関数:dictのデータを使用して元のログをエンリッチし、statusフィールドの値が500の場合、新しいフィールドmessageをエンリッチして作成し、値はFailedです。//2. fields_Set関数:新しいフィールドnewを追加し、値1を割り当てます。compose(enrich_dict("{\\"200\\":\\"SUCCESS\\",\\"500\\":\\"FAILED\\"}", "status", output="message"), fields_set("new", 1))
//最終結果は3つのフィールドで、以下の通りです:{"new":"1","message":"FAILED","status":"500"}
{"status": "500"}
compose(fields_set("new", 1))
{"new":"1","status":"500"}
{"condition1": 0,"condition2": 1, "status": "500"}
t_if_else(v("condition2"), compose(fields_set("new", 1),fields_set("target1","1")), fields_set("target2","0"))
{"new":"1","condition1":"0","condition2":"1","status":"500","target1":"1"}
t_if(条件1, 関数1)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
condition | 戻り値が BOOL 型の関数式 | BOOL | はい | - | - |
function | 戻り値が LOG 型の関数式 | string | はい | - | - |
{"condition": 1, "status": "500"}
t_if(True, fields_set("new", 1))
{"new":"1","condition":"1","status":"500"}
//conditionフィールドの値が真の場合、新しいフィールドnewを追加し、値1を割り当てます。{"condition": 1, "status": "500"}
t_if(v("condition"), fields_set("new", 1))
{"new":"1","condition":"1","status":"500"}
t_if_not(条件1, 関数1)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
condition | 戻り値が BOOL 型の関数式 | BOOL | はい | - | - |
function | 戻り値が LOG 型の関数式 | string | はい | - | - |
{"condition": 0, "status": "500"}
t_if_not(v("condition"), fields_set("new", 1))
{"new":"1","condition":"0","status":"500"}
t_if_else(条件1, 関数1, 関数2)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
condition | 戻り値が BOOL 型の関数式 | BOOL | はい | - | - |
function | 戻り値が LOG 型の関数式 | string | はい | function1 | - |
function | 戻り値が LOG 型の関数式 | string | はい | function2 | - |
{"condition": 1, "status": "500"}
t_if_else(v("condition"), fields_set("new", 1), fields_set("new", 2))
{"new":"1","condition":"1","status":"500"}
t_switch(条件1, 関数1, 条件2, 関数2, ...)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
可変引数、条件と関数式が交互にパラメータとして渡されます。 | t_if 関数を参照し、複数の t_if の組み合わせに類似しています。 | function | 少なくとも1組の条件と関数式が必要です。また、パラメータは 条件, 関数のペアで渡す必要があります。 | - | - |
{"condition1": 0,"condition2": 1, "status": "500"}
//condition1フィールドの値が真の場合、新しいフィールドnewを追加し、値1を割り当てます。ここではフィールド値が偽を返すため、「new」:「1」は追加されません。2番目の条件が真を返すため、「new」:「2」が追加されます。t_switch(v("condition1"), fields_set("new", 1), v("condition2"), fields_set("new", 2))
{"new":"2","condition1":"0","condition2":"1","status":"500"}
フィードバック