首页 > 解决方案 > 如何将表情符号作为 Logstash 的 HTTP-OUTPUT-PLUGIN 的一部分发送到 Telegram bot

问题描述

我想使用 http-output-plugin 将表情符号作为消息的一部分从 logstash 发送到电报机器人,并将其显示在电报组中。PFB 正在使用的代码。请建议。

http {
    format => "json"
    http_method => "post"
    url => "https://api.telegram.org:443/bot481032672:AAGhbY0l6cuy_HXA-SyiJHbwRznPdA3KPaQ/sendMessage"
    mapping => {
        "chat_id" => "-191360460"
        "text" => "Severity=%{SNMPv2-SMI::enterprises.111.15.3.1.1.5.1}
        App Name=%{kpi_match_name}
        RUEI KPI Name=%{SNMPv2-SMI::enterprises.111.15.3.1.1.14.1}
        Current Value=%{kpi_cur_value}"
    }
}

SY

标签: logstashtelegram-botemoji

解决方案


这对我有用。

  1. 添加

    parse_mode: "HTML"

到您的“映射”数组。这会将文本呈现为 HTML。有关详细信息,请参阅https://core.telegram.org/bots/api#sendmessage

  1. 将表情符号添加为“

推荐阅读