标签: elastic-stack

Logstash不使用多个文件通配符路径

Logstash似乎没有使用通配符读取路径这里是我的配置文件

input {
    file {
        path => "C:\logs\app*.log"
        type => "MyType"            
    }   
}
filter {
}
output {
    elasticsearch {

  }
}
Run Code Online (Sandbox Code Playgroud)

elasticsearch logstash elastic-stack

5
推荐指数
2
解决办法
4247
查看次数

表达式中使用的字段[]在映射中不存在

我尝试填充的功能是在kibana中创建一个度量标准,显示"未经验证"的用户数.我发送用户注册时发送的日志,然后验证用户验证时的日志.

所以我想要的数量是注册数量和验证数量之间的差异.

在kibana我不能做这样的数学运算,所以我找到了一个解决方法:我添加了一个名为"unvalidated"的"脚本字段",当用户注册时等于1,当用户验证他的帐户时等于-1."未经验证"字段的总和应该是未经验证的用户的数量.

这是我在脚本字段中定义的脚本: doc['ctxt_code'].value == 1 ? 1 : doc['ctxt_code'].value == 2 ? -1 : 0

有:

  • ctxt_code 1作为寄存器日志

  • ctxt_code 2作为验证日志

当我的所有日​​志都有"ctxt_code"时,此设置很有效,但是当没有此字段的日志被推送时,kibana会抛出以下错误:

Field [ctxt_code] used in expression does not exist in mappings kibana错误

我无法理解这个错误,因为kibana说:

If a field is sparse (only some documents contain a value), documents missing the field will have a value of 0

情况就是这样.

有人有线索吗?

elasticsearch kibana elastic-stack

5
推荐指数
1
解决办法
1007
查看次数

如何从Dockerized Node应用程序中将应用程序日志发送到Elasticsearch?

我有一个小node脚本,我用它bunyan来处理应用程序日志记录.记录器写入本地存储.我想将日志发送到elasticsearch使用filebeat(这两个对我来说都是新技术).

我已经制作了一个dockerfile容器应用程序(下面),但我不确定如何/在哪里插入必要的指令.有没有办法elasticsearch从我的内部发送我的日志docker?虽然我在它,也发送docker container&os发出的任何日志?

# dockerfile. 
# installations and entrypoint are to run nightmarejs headless
FROM node:latest

RUN apt-get update &&\
    apt-get install -y libgtk2.0-0 libgconf-2-4 \
    libasound2 libxtst6 libxss1 libnss3 xvfb

WORKDIR /app
COPY ./dist .

# enable installation of private npm modules
ARG NPM_TOKEN  
COPY .npmrc .npmrc  
COPY package.json .
RUN npm i
RUN rm -f .npmrc
COPY entrypoint /
RUN chmod +x …
Run Code Online (Sandbox Code Playgroud)

node.js docker bunyan elastic-stack

5
推荐指数
0
解决办法
1488
查看次数

考虑在您的配置中定义一个名为“elasticsearchTemplate”的 bean

我刚刚启动 springboot 并尝试使用 spring-boot 实现弹性搜索,但在运行 spring-boot 应用程序时出现此类错误

考虑在您的配置中定义一个名为“elasticsearchTemplate”的 bean。

POM文件

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>4.0.0</version>
        </dependency>
         <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>5.6.10</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
        
        
    </dependencies>
Run Code Online (Sandbox Code Playgroud)

存储库

@Repository
public interface StudentRepository extends ElasticsearchRepository<Student, Integer>{}
Run Code Online (Sandbox Code Playgroud)

控制器

@RestController
public class Controller {
    
    @Autowired
    StudentRepository studentRepo;
    
    @GetMapping(value="/student/all")
    List<Student> getAllStudent() {
        
        Iterator<Student> studentList = studentRepo.findAll().iterator();
        List<Student> students = …
Run Code Online (Sandbox Code Playgroud)

java spring elasticsearch spring-boot elastic-stack

5
推荐指数
1
解决办法
5543
查看次数

Kubernetes 上的 Elasticsearch - “弹性云 (ECK)”与“Helm 图表”

为了日志文件聚合的目的,我希望在本地(普通)Kubernetes 集群上设置一个生产 Elasticsearch 实例。

部署似乎有两个主要选项:

  1. 弹性云 (ECK) - https://github.com/elastic/cloud-on-k8s
  2. Helm 图表 - https://github.com/elastic/helm-charts

我已经成功使用了旧的(即将被弃用的)舵图,但刚刚发现了 ECK。

这两种选择的优点和缺点是什么?有任何可能影响长期使用的约束或限制吗?

elasticsearch kubernetes elastic-stack kubernetes-helm

5
推荐指数
1
解决办法
4600
查看次数

如何将日志收集到 Elasticsearch

我在不同的服务器(许多机器)中有网络应用程序的日志。如何在安装了 Elastic search 和 Kibana 的系统中收集这些日志。当我搜索时,我只找到了显示设置的教程,其中logslogstashbeats和都在一起。elasticsearchkibana

elasticsearch elastic-stack

5
推荐指数
1
解决办法
1万
查看次数

如何将日志数据从 Azure Application Insights 导出到 Elastic Stack?

有没有办法将日志数据从 Application Insights 导出到 Elasticsearch?

Application Insights 正在监视我的弹性集群。

我希望能够将这些日志导出到 Elasticsearch。我在想,如果我随后将 sql-db 与 Logstash 连接起来,那么使用流分析设置连续导出到 sql 可能会起作用。

但这似乎不必要地复杂。

任何想法和想法都值得赞赏。提前。

编辑以澄清:我想将 Application Insights 数据导出到单独的 Azure/弹性集群。

elasticsearch logstash azure-monitoring azure-application-insights elastic-stack

5
推荐指数
0
解决办法
786
查看次数

Elasticsearch 搜索 API 未返回所有结果

我有三个索引,所有三个索引共享一个特定的键值对。当我使用请求正文使用api“ http://localhost:9200/_search ”进行全面搜索时

{"query":{
    "query_string":
    {
        "query":"city*"

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

它仅返回两个索引的结果。我尝试通过更改 url 来使用相同的请求正文,以仅在丢失的索引“ http://localhost:9200/index_name/_search ”中进行搜索,并且该方法有效。我在这里错过了什么吗?

插入所有三个索引的代码遵循相同的过程,我使用 elasticsearch-py 来提取数据。

我正在使用 GET HTTP 方法,还尝试了 POST HTTP 方法。两者返回相同的结果。Elasticsearch 版本是 7.6.0。

特定索引搜索的结果如下所示

{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "index_name",
                "_type": "meta",
                "_id": "LMRqDnIBh5wU6Ax_YsOD",
                "_score": 1.0,
                "_source": {
                    "table_schema": "test_table",
                    "table_name": "citymaster_old" 
                }
            }
        ]
    }
}

Run Code Online (Sandbox Code Playgroud)

python elasticsearch elastic-stack

5
推荐指数
1
解决办法
7762
查看次数

Elasticsearch - 希望在该特定字段可用或不可用的所有索引中按字段排序,如果不可用,则避免它

目前,根据评分获取结果但我想要做的是我想要基于评分+字段状态的结果,值为真/假。

如果值为真,则需要导致优先级,但有可能并非所有索引中都存在状态字段

           "query" => [
                  'bool' => [
                     'filter' => $filter,
                     'must' => [
                     "multi_match" => [
                        'query' => "$string",
                        "type" => "cross_fields",
                        'fields' => ['field1','field2','field3'],
                        "minimum_should_match" => "80%"
                         ]
                    ]
                  ]
            ],
            "sort" => [
                    "_score",
                    [ "status" => ["order" => "desc","unmapped_type" => "boolean"] ]
            ],
Run Code Online (Sandbox Code Playgroud)

但得到以下错误:

[type] => illegal_argument_exception
[reason] => Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by …
Run Code Online (Sandbox Code Playgroud)

php search elasticsearch elastic-stack elk

5
推荐指数
1
解决办法
2万
查看次数

Elasticsearch:java.lang.OutOfMemoryError 后重启节点:Java 堆空间

我的 ES 节点之一因java.lang.OutOfMemoryError: Java heap space错误而失败。这是日志中的完整堆栈跟踪:

    [2020-09-18T04:25:04,215][WARN ][o.e.a.b.TransportShardBulkAction] [search1] [[my_index_4][0]] failed to perform indices:data/write/bulk[s] on replica [my_index_4][0], node[cm_76wfGRFm9nbPR1mJxTQ], [R], s[STARTED], a[id=BUpviwHxQK2qC3GrELC2Hw]
org.elasticsearch.transport.NodeDisconnectedException: [search3][X.X.X.179:9300][indices:data/write/bulk[s][r]] disconnected
[2020-09-18T04:25:04,215][WARN ][o.e.c.a.s.ShardStateAction] [search1] [my_index_4][0] received shard failed for shard id [[my_index_4][0]], allocation id [BUpviwHxQK2qC3GrELC2Hw], primary term [2], message [failed to perform indices:data/write/bulk[s] on replica [my_index_4][0], node[cm_76wfGRFm9nbPR1mJxTQ], [R], s[STARTED], a[id=BUpviwHxQK2qC3GrELC2Hw]], failure [NodeDisconnectedException[[search3][X.X.X.179:9300][indices:data/write/bulk[s][r]] disconnected]]
org.elasticsearch.transport.NodeDisconnectedException: [search3][X.X.X.179:9300][indices:data/write/bulk[s][r]] disconnected
[2020-09-18T04:25:04,215][DEBUG][o.e.a.a.c.n.i.TransportNodesInfoAction] [search1] failed to execute on node [cm_76wfGRFm9nbPR1mJxTQ]
org.elasticsearch.transport.NodeDisconnectedException: [search3][X.X.X.179:9300][cluster:monitor/nodes/info[n]] disconnected
[2020-09-18T04:25:04,219][INFO ][o.e.c.r.a.AllocationService] [search1] Cluster health status changed from …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch elastic-stack elasticsearch-5

5
推荐指数
0
解决办法
694
查看次数