1

尝试通过 UTL_TCP 从 Oracle 向 Graylog GELF TCP 发送数据时遇到问题。

我尝试使用单个事件(记录,JSON 格式,根据 Graylog 要求)。问题在于,虽然单个事件确实正确上传,但我也生成了 45 个 Graylog 内部事件,显然与其中两个有关:

.....
"2018-12-18T14:13:33.938Z","graylog-server","runit-service","true","6","ERROR [NettyTransport] Error in Input [GELF TCP/5c119b1eb358cb056b417b89] (channel [id: 0x1957cea0, /192.168.1.22:49550 :> /192.168.1.74:41000])"
.....
"2018-12-18T14:13:33.959Z","graylog-server","runit-service","true","6","java.lang.IllegalStateException: GELF message is too short. Not even the type header would fit."
.....

我在 Oracle 中使用的 PL SQL 代码如下:

create or replace procedure AAA_GRAYLOG_TCP_05
is

conn                utl_tcp.connection;
v_GL_record         clob;
ret_val             pls_integer;

v_lms_host          varchar2(4000) := '192.168.1.74';
v_lms_port          number := 41000;

begin

v_GL_record := 
'{ "version": "1.1", "host": "dataplus05", "short_message": "A short message", "level": 5, "_some_info": "foo" }' 
;

dbms_output.put_line(v_GL_record);

conn := utl_tcp.open_connection(
remote_host => v_lms_host, 
remote_port => v_lms_port
);
ret_val := UTL_TCP.WRITE_LINE(conn, v_GL_record);
utl_tcp.close_connection(conn);

end;

我尝试添加一些:

\"0", or \0, after the last }

到 v_GL_record 的末尾,但无济于事。我仍然有 45 条额外记录,并且生成了 ERROR 和 Java.IllegalState

在打开连接时,还尝试使用相同的反斜杠零而不是默认的 CL-FR:

conn := utl_tcp.open_connection(
remote_host => v_lms_host, 
remote_port => v_lms_port,  
newline => '\0'
);

仍然是同样的问题。

有人可以帮忙吗?

此致,

阿尔廷

Graylog内部消息列表:

graylog 额外的内部消息

4

0 回答 0