V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iceecream
V2EX  ›  Elasticsearch

Logstash 不按日期创建索引

  •  
  •   iceecream · 2020-04-01 19:43:03 +08:00 · 2879 次点击
    这是一个创建于 1457 天前的主题,其中的信息可能已经有所发展或是发生改变。
    输出:
    output {
    elasticsearch {
    hosts => ["localhost"]
    index => "logstash-%{+YYYY.MM.dd}"
    }
    }
    索引模板:
    {
    "logstash" : {
    "order" : 0,
    "index_patterns" : [
    "logstash-*"
    ],
    "settings" : {
    "index" : {
    "number_of_shards" : "1"
    }
    },
    "mappings" : { },
    "aliases" : { }
    }

    在 ES7.2 中,创建的是 logstash 索引,而不是 logstash-2020.xx.xx 这种索引。求大佬指点一下,如何才能再次回到如何获取 Logstash 使用带有日期标记的索引?
    3 条回复    2020-04-02 10:33:18 +08:00
    DonaldY
        1
    DonaldY  
       2020-04-02 01:28:35 +08:00
    炸一看,貌似没有问题诶。应该会自动创建 logstash-xxxx.xx.xx
    iceecream
        2
    iceecream  
    OP
       2020-04-02 10:10:15 +08:00
    @DonaldY 实际上,测试了很多次,还是不会。不知道哪里出问题了。
    iceecream
        3
    iceecream  
    OP
       2020-04-02 10:33:18 +08:00
    解决方法如下:
    index => "logstash-%{+yyyy.MM.dd}"
    yyyy 要小写。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1769 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 16:34 · PVG 00:34 · LAX 09:34 · JFK 12:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.