我正在运行docker容器的集群中运行ELK(Elasticsearch,Logstash,Kibana).这些容器通过GELF端点将日志发送到Logstash.
docker run --log-driver=gelf --log-opt gelf-address=udp://somehost:12201 -ti my-app:latest
Run Code Online (Sandbox Code Playgroud)
然后我在Logstash中处理日志.在这里,我想折叠多行消息并将它们合并为一个单独的事件(在我的例子中是Java异常).我的配置是:
input {
gelf {}
}
filter{
multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
source => "short_message"
}
}
output {
stdout { codec => rubydebug }
}
Run Code Online (Sandbox Code Playgroud)
当我从一个docker容器处理日志时,它工作得很好,但是对于两个或更多个,它不起作用,因为它会折叠两个(或更多)日志流的消息.
我希望,在输入中设置多线程可以解决问题
input {
gelf {
filter{
multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
}
}
Run Code Online (Sandbox Code Playgroud)
但多线程无法正常使用此设置(似乎是因为bug).有什么建议?谢谢.
我正在使用:Docker 1.9.1,Logstash 2.1
我正在尝试正确格式化一个查询,该查询返回给定点 geo_shape 的多边形 geo_shape。
elasticsearch版本是2.2.1
我的映射是
"outputarea-index" : {
"aliases" : { },
"mappings" : {
"outputarea" : {
"properties" : {
"location" : {
"type" : "geo_shape",
"tree" : "quadtree",
"precision" : "10.0m"
},
"oa_id" : {
"type" : "string"
}
}
}
},
Run Code Online (Sandbox Code Playgroud)
我的文件是
"type": "Feature", "properties": { "OA11CD": "E00000001", "LAD11CD": "E09000001" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -0.094486180992449, 51.520329824877336 ], [ -0.094515616052987, 51.52023932543856 ], [ -0.094539915144025, 51.520164470526943 ], [ -0.094544324018805, 51.52015070261556 ], [ -0.094573093007717, …
我的 Logstash 具有以下配置来导入一些 CSV 文件:
\n\ninput {\n file {\n path => [\n "C:\\Data\\Archive_ATS_L1\\2016-10-08-00-00_to_2016-10-09-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-09-00-00_to_2016-10-10-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-10-00-00_to_2016-10-11-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-11-00-00_to_2016-10-12-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-12-00-00_to_2016-10-13-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-13-00-00_to_2016-10-14-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv",\n "C:\\Data\\Archive_ATS_L1\\2016-10-14-00-00_to_2016-10-15-00-00\\S2KHistorian\\Historian\\S2KEventMsg_Table.csv"\n ]\n start_position => "beginning" \n }\n}\nfilter {\n csv {\n separator => ","\n columns => ["MessageCode","SourceGuid","DateTimeGenerated","Code1","Code2","Code3","Code4","LanguageCode", "AlarmSeverity", "Message", "Guid1", "Guid2", "Guid3", "Guid4", "MessageOrigin", "RequestId", "Bool1", "Bool2", "Bool3", "Bool4", "Bool5", "Bool6", "Bool7", "Bool8", "Code5", "Code6", "Bool9", "Bool10", "Bool11", "Code7"]\n }\n}\noutput { \n elasticsearch {\n action => "index"\n hosts => "localhost"\n index => "S2K"\n workers => 1\n }\n stdout {}\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我使用以下命令行启动logstash:
\n\n …我正在尝试按照官方文档学习 Elastic Search 中的无痛脚本编写。(https://www.elastic.co/guide/en/elasticsearch/painless/6.0/painless-examples.html)
我正在使用的文档示例:
{
"uid" : "CT6716617",
"old_username" : "xyz",
"new_username" : "abc"
}
Run Code Online (Sandbox Code Playgroud)
使用 params._source 访问文档值的以下脚本字段查询有效:
{
"script_fields": {
"sales_price": {
"script": {
"lang": "painless",
"source": "(params._source.old_username != params._source.new_username) ? \"change\" : \"nochange\"",
"params": {
"change": "change"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
相同的查询但使用文档映射来访问值失败:
{
"script_fields": {
"sales_price": {
"script": {
"lang": "painless",
"source": "(doc['old_username'] != doc['new_username']) ? \"change\" : \"nochange\"",
"params": {
"change": "change"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到的错误消息是:
"caused_by" : {
"type" : …Run Code Online (Sandbox Code Playgroud) 100k我正在从一个索引中获取多个文档searchScroll,并在所有文档中再添加一个字段100K。然后再次将这些文档插入到另一个新索引中。
我正在使用SearchScrollapi 也正在设置大小,searchSourceBuilder.size(100)我已将大小增加到searchSourceBuilder.size(1000)。在这两种情况下,处理18100文档(当 searchSourceBuilder.size(100) 时)和21098文档(当 searchSourceBuilder.size(1000) 时)后都会出现以下错误。
search_context_missing_exception","reason":"No search context found for id
并且,错误抛出在这一行searchResponse = SearchEngineClient.getInstance().searchScroll(scrollRequest);
请找到我完整的错误堆栈
Exception in thread "main" ElasticsearchStatusException[Elasticsearch exception
[type=search_phase_execution_exception, reason=all shards failed]]; nested: Elas
ticsearchException[Elasticsearch exception [type=search_context_missing_exceptio
n, reason=No search context found for id [388]]];
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestR
esponse.java:177)
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLeve
lClient.java:573)
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(R
estHighLevelClient.java:549)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighL
evelClient.java:456)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEn
tity(RestHighLevelClient.java:429)
at org.elasticsearch.client.RestHighLevelClient.searchScroll(RestHighLev
elClient.java:387)
at com.es.utility.DocumentIndex.main(DocumentIndex.java:101)
Suppressed: org.elasticsearch.client.ResponseException: method [GET], …Run Code Online (Sandbox Code Playgroud) 我正在寻找 Logstash RAM 问题的答案,因为它几乎 100%。我进行了很多搜索,但它们并不适合我。下面的代码是我的logstash.conf 文件。我认为这需要一些小改动。
Logstash.conf:
input {
file {
path => ["c:/mylogs/*.txt"]
start_position => "beginning"
discover_interval => 10
stat_interval => 10
sincedb_write_interval => 10
close_older => 10
codec => "json"
}
}
filter {
date {
match => ["mydate","yyyy-MM-dd HH:mm:ss.SSSS" ]
timezone => "UTC"
}
date {
match => ["TimeStamp", "ISO8601"]
}
json {
source => "request"
target => "parsedJson"
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => [ "http://localhost:9200" ]
index …Run Code Online (Sandbox Code Playgroud) 我正在获取Logstash的Java版本和mysql-connect-java.jar兼容性问题。
谁能告诉我哪个版本的mysql-connect-java.jar与哪个版本的Java兼容?
错误:
com.mysql.cj.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Run Code Online (Sandbox Code Playgroud)
我当前的Java版本是
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.16.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
Run Code Online (Sandbox Code Playgroud)
我曾尝试使用以下mysql连接器jar文件,但每个失败。
mysql-connector-java-8.0.16.jar
mysql-connector-java-8.0.15.jar
mysql-connector-java-6.0.5.jar
mysql-connector-java-5.1.46.jar
mysql-connector-java-5.1.4.jar
Run Code Online (Sandbox Code Playgroud)
Logstash配置文件是mysql.conf
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/prbi"
jdbc_user => "root"
jdbc_password => ""
jdbc_driver_library => "mysql-connector-java-8.0.15.jar" #tried above every jar
jdbc_driver_class => "com.mysql.cj.jdbc.Driver" #tried com.mysql.jdbc.Driver too
schedule => "* * * * *"
use_column_value => true
tracking_column => "%{id}" …Run Code Online (Sandbox Code Playgroud) 我对使用 Elastic Stack 还很陌生,所以请原谅我缺乏这方面的知识。我在 Windows 10 公司工作计算机上运行 Elastic Stack。我已经为 bash cli 安装了 Git Bash,并且可以成功启动整个 Elastic Stack。我的任务是获取存储在我们的数据库之一中的日志数据并将其显示在 Kibana 仪表板上。
根据我和我的团队的推理,我不需要使用 Logstash,因为日志发送到的数据库实际上是我们的“日志存储”,因此使用 Logstash 服务将是多余的。我发现了这个漂亮的图表
在 freecodecamp 上,据我所知,Logstash 只是日志检索不同服务的中介。因此,我可以不使用 Logstash,因为日志数据已经在数据库中,我可以这样做
USER ---> KIBANA <---> ELASTICSEARCH <--- My Python Script <--- [DATABASE]
Run Code Online (Sandbox Code Playgroud)
我的 python 脚本成功调用我们的数据库并检索数据,以及将数据塑造成 dict 对象的函数(据我所知,Elasticsearch 以 JSON 格式获取数据)。
现在我想将所有这些数据插入 Elasticsearch - 我一直在阅读 Elastic 文档,并且有很多关于索引的讨论,但并不是真正的索引,而且我还没有找到任何可以用来插入的 API 调用将数据直接导入 Elasticsearch。到目前为止我找到的所有文档都涉及 Logstash 的使用,但由于我没有使用 Logstash,所以我在这里有点不知所措。
如果有人可以帮助我并指出正确的方向,我将不胜感激。谢谢
-担
我遇到 APM 服务器和 APM 代理 (Elastic Stack) 的兼容性问题。
"elastic-apm-node": "^3.0.0"
Run Code Online (Sandbox Code Playgroud)
配置:
var apm = require('elastic-apm-node').start({
serviceName: "******-dev",
captureBody: 'all',
stackTraceLimit: 10,
transactionMaxSpans:10,
serverUrl: "http://localhost:5601"
}).addErrorFilter(function (payload) {
if(payload.context.response && payload.context.response.status_code === 429){
return false;
}
return payload;
})
Run Code Online (Sandbox Code Playgroud)
APM服务器版本: 7.4.0
错误:
APM Server responded with "404 Not Found". This might be because you're running an incompatible version of the APM Server. This agent only supports APM Server v6.5 and above. If you're using an older version of the APM Server, …Run Code Online (Sandbox Code Playgroud) elastic-stack ×10
logstash ×5
java ×2
kibana ×2
apm ×1
docker ×1
geojson ×1
geospatial ×1
geotagging ×1
kibana-5 ×1
mysql ×1
node.js ×1
plot ×1
python ×1
windows ×1