-
-
-
-
-
-
-
-
-
-
-
-
-
-
チュートリアル - プロトコル拡張を使用してsyslogメッセージの負荷分散を行う
-
This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已动态机器翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.
Este artigo foi traduzido automaticamente.
这篇文章已经过机器翻译.放弃
Translation failed!
チュートリアル-プロトコル拡張を使用した syslog メッセージのロードバランシング
Citrix ADCアプライアンスで使用可能なSyslogプロトコルは、Citrix ADCアプライアンスで生成されたメッセージに対してのみ機能します。外部ノードからのメッセージの負荷分散は行われません。このようなメッセージをロードバランシングするには、プロトコル拡張機能を使用し、Lua 5.2 プログラミング言語を使用して syslog メッセージ解析ロジックを記述する必要があります。
syslog メッセージを解析するためのコード
このコードには、TCP クライアントデータコールバック関数 (client.on_data ()) のみが定義されています。サーバーデータの場合、コールバック関数を追加せず、サーバーからクライアントへの高速ネイティブパスを取得します。このコードは、末尾の文字に基づいてメッセージの境界を識別します。TCP パケットに複数の syslog メッセージが含まれている場合は、末尾の文字に基づいてパケットを分割し、各メッセージをロードバランシングします。
--[[
Syslog event handler for TCP client data
ctxt - TCP client side App processing context.
data - TCP Data stream received.
--]]
function client.on_data(ctxt, payload)
local message = nil
local data_len
local data = payload.data
local trailing_character = "\n"
::split_message::
-- Get the offset of trailing character
local new_line_character_offset = data:find(trailing_character)
-- If trailing character is not found, then wait for more data.
if (not new_line_character_offset) then
goto need_more_data
end
-- Get the length of the current message
data_len = data:len()
-- Check whether we have more than one message
-- by comparing trailing character offset and
-- current data length
if (data_len > new_line_character_offset) then
-- If we have more than one message, then split
-- the data into two parts such that first part
-- will contain message upto trailing character
-- offset and second part will contain
-- remaining message.
message, data = data:split(new_line_character_offset)
else
message = data
data = nil
end
-- Send the data to the backend server.
ns.send(ctxt.output, "EOM", {data = message})
goto done
::need_more_data::
-- Wait for more data
ctxt:hold(data)
data = nil
goto done
::done::
-- If we have more data to parse,
-- then do parsing again.
if (data) then
goto split_message
end
end
共有
共有
This Preview product documentation is Citrix Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Citrix Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Citrix product purchase decisions.
If you do not agree, select Do Not Agree to exit.