0
我有一个Web应用程序和一个Graylog服务器。我想发送一个ajax消息到所述的Graylog服务器。他们提供的唯一示例是:JQuery ajax调用Graylog2不起作用
curl -XPOST http://graylog.example.org:12202/gelf -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'
工作得很好。但是,当我这样做:
message = '{"host":"hostname","short_message":"short message","full_message":"longer message","facility":"dev"}';
console.log(message);
$.ajax({
url: 'http://X.X.X.X:12201/gelf',
method: 'POST',
data: JSON.stringify(message),
success: function(result, textStatus, jqXHR){
console.log("SF Log posted with result: " + result);
if ($.isFunction(settings.callback)) {
settings.callback.call(this);
}
},
error: function(jqXHR, textStatus, errorThrown){
console.log("SF Log encountered error: " + errorThrown);
},
complete: function(){
console.log('on complete: ' , this.data);
}
});
该消息收到Graylog,但它拒绝处理它。它只是在期刊中。
这是我正在写的一个插件的当前配置,所以我们可以登录不同的区域。我已将crossDomain设置为true,并尝试使用$ .post,但由于某种原因,我的环境不允许我。任何想法我可以尝试什么?