当我尝试通过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'
);
还是同样的问题。
有人可以帮忙吗?
最好的问候
Altin
Graylog内部消息列表: