Opsgenie 統合での文字列処理メソッド
Opsgenie は、メール内の受信メールを解析し、ルールや自動化などを警告する文字列処理メソッドを提供します。
Opsgenie のメール ルールでは、これらのメールを処理し、メール データから情報を抽出し、適切なアラート フィールドに割り当て、適切なアクション (作成、確認、クローズなど) を実行できます。受信メールからデータを抽出するために、Opsgenie では文字列処理メソッドをご提供します。現時点では、以下のメソッドがサポートされています。
toLowerCase(): テキスト内のすべての文字を小文字に変換し、結果の文字列を返します。
{{ message.toLowerCase() }}
toUpperCase(): テキスト内のすべての文字を大文字に変換し、結果の文字列を返します。
{{ message.toUpperCase() }}
substring(int from), substring(int from, int to): 指定されたインデックス間の文字列を返します。"from" は含まれ、"to" は除外されます。{{ from_name.substring(5,20) }}
)
substringAfter(String from): 指定されたパラメーターの後に文字列を返します
{{ subject.substringAfter("Host") }}
substringBefore(String to): returns the string before the specified parameter{{ from_address.substringBefore("@") }}
substringBetween(String from, String to): returns the string between from and to parameters{{ subject.substringBetween("URL:","(") }}
extract(regular expression): 正規表現の括弧で囲まれたセクションに一致する文字列の一部を返します。{{ message.extract(/Host: (\S+)/) }}
)
You can refer Regular Expression for further information about extract method.
Regex match operations has 10 seconds timeout limit. If it takes more than 10 seconds, it returns "null"
string.
toDate(): タイムスタンプの日時変換を返します。日時の形式には "yyyy-MM-dd HH:mm:ss ZZZ" の既定値、タイム ゾーンには "GMT" の既定値を使用します。{{ message.toDate() }}
)
toDate(String dateTimeFormat): returns date time conversion of a timestamp. Time format argument should follow Java's Simple Date formatting pattern. Uses default value of "GMT" for time zone.{{ message.toDate("yyyy-MM") }}
toDate(String dateTimeFormat, String timeZone): returns date time conversion of a timestamp. Time format argument should follow Java's Simple Date formatting pattern.{{ message.toDate("yyyy-MM", "GMT+2") }}
toReadableNumber(): + 文字が存在する場合は削除し、指定された文字列内のすべての文字を単一の空白で分割します。このメソッドをアラート メッセージ内の電話番号に適用するのは最も一般的なケースで、電話番号内の各数字を 1 つずつリッスンできます。{{ from.toReadableNumber() }}
)
removeAllWhitespace(): 指定したパラメーターから空白、改行、タブ、およびキャリッジ リターン文字を削除し、結果の文字列を返します。{{ message.removeAllWhitespace() }}
)
urlEncode(): 文字列を以下に変換します。
application/x-www-form-urlencoded
MIME format, based on the UTF-8
character set. For more information about the escape characters, you can refer Special characters in URI attribute values.{{ subject.urlEncode() }}
この内容はお役に立ちましたか?