在刚刚开始接触ELK的时候我们习惯把每一个index都按照day来切割。但是我们会发现我们的shards 会很多。

其实我们一该把那些小的index按照一周或者一个月来rolling,来减少我们的shards数。

我使用的是logstash5,这里我们每启动一个logstash的进程的时候我们会发现我们的jvm 参数的-Xmx1g -Xms1g

但是我么一些可以设置小一点,比如512m 甚至是256m 来减少资源分配

具体的操作方案:

原文来自于:http://www.atechref.com/blog/elk/elk-stack-logstash-mutate-and-monthly-index-setting/

How often should a new log index be created? Once a day, Once a week, Once a month? A simple search in Google would return various responses each arguing the pros and cons of creating indexes daily or weekly. Lets look at how to do that with logstash.

My take on that is “once a month” index is the best option.  The following is my reasoning for this.

Pros:

Easier back up with a monthly index
Simple to create snapshots and restore
One index to backup externally on NAS or other storage outside of ELK stack
Works well where the retention policy for active logs is days or days etc
Allows complete logs for the whole month to be restored in one go.
Cons: Potential for large index sizes
Have to restore the whole index to search for a specific day of the month
Backup and restore of these indexes can take some time in slower systems or single node instances
Creating a monthly rolling index file In order to create a new index each month automatically ensure you have the following setting in your logstash config file for e.g. devlogstash.conf. input{
….
}
filter{
….
}
output{
elasticsearch{ hosts => [“192.168.0.1:”]
index => “dev-logstash-%{+YYYY.MM}” } }
Creating a weekly rolling index file The weekly name format would be YYYY.ww as in 2017.01 for the first week of the year in number. Config setting would be as shown below. input{
….
}
filter{
….
}
output{
elasticsearch{ hosts => [“192.168.0.1:”]
index => “dev-logstash-%{+YYYY.ww}” } }
Creating a daily rolling index file Just add MM.DD instead of WW to the setting above to create a daily rolling index as shown below. input{
….
}
filter{
….
}
output{
elasticsearch{ hosts => [“192.168.0.1:”]
index => “dev-logstash-%{+YYYY.MM.DD}” } }
Creating a Year, month and week rolling index file And that could be defined as YYYY.MM.ww to create a weekly rolling index as shown below. input{
….
}
filter{
….
}
output{
elasticsearch{ hosts => [“192.168.0.1:”]
index => “dev-logstash-%{+YYYY.MM.ww}” } }
Restart logstash for these changes to take effect.

Create rolling monthly, weekly and daily Logstash indices的更多相关文章

  1. log4j日志配置(按天/按日)

    项目中尽管对log4j有基本的配置,例如按天生成日志文件以作区分,但如果系统日志文件过大,则就需要考虑以更小的单位切分或者其他切分方式.下面就总结一下log4j常用的配置参数以及切分日志的不同方式. ...

  2. [Java][log4j]支持同一时候按日期和文件大小切割日志

    依据DailyRollingFileAppender和RollingFileAppender改编,支持按日期和文件大小切割日志.  源文件: package com.bao.logging; impo ...

  3. log4j配置参数详解——按日志文件大小、日期切分日志文件

    项目中尽管对log4j有基本的配置,例如按天生成日志文件以作区分,但如果系统日志文件过大,则就需要考虑以更小的单位切分或者其他切分方式.下面就总结一下log4j常用的配置参数以及切分日志的不同方式. ...

  4. 【Logstash系列】使用Logstash作为收集端采集IIS日志

    现阶段Logstash在Windows端的日志采集一直存在若干问题,包括:   1. LS有读锁:进程开启后Input指定路径下的所有文件都会被锁死无法重命名或删除. 2. LS不识别*:如果在pat ...

  5. logstash 对配置文件conf敏感信息,密码等加密

    logstash的配置文件conf经常会涉及敏感信息,比如ES,mysql的账户密码等,以下使用logstash导入mysql为例子,加密隐藏mysql的密码. 在向keystore中添加key及其s ...

  6. matplot模块中的pylab

    pylab的目的 Pylab combines the functionality of pyplot with the capabilities of NumPy in a single names ...

  7. Ansible简明使用手册

            Ansible使用简明手册 1.简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric ...

  8. Oracle 调度程序(scheduler)摘自一位大神

    在11g中,Oracle提供了一个新建的Scheduler特性,帮助将作业实现自动化.它还可以帮助你控制资源的利用与并可以将数据库中的作业按优先顺序执行.传统的dbms_jobs的一个限制是它只能调度 ...

  9. C# 添加系统计划任务方案

    你可以在Windows 计划任务管理器里面添加计划任务,调试OK后导出XML文件,然后在要部署的计算机上执行CMD导入命令,把计划任务信息配置导入到服务器上的计划任务列表中,命令如下: SCHTASK ...

随机推荐

  1. 【shell】各种括号()、(())、[]、[[]]、{}的使用

    圆括号 1.单圆括号() ①命令组,括号中的命令将会开启一个子shell独立运行:括号中以分号连接,最后一个命令不需要;各命令和括号无需空格 Linux:/qins # (var=1;echo $va ...

  2. 【Linux】特殊符号$$,$#,$?等解释

    在linux系统中有很多的特殊符号,他们具有特殊的意义 $# 是传给脚本的参数个数 $0 是脚本本身的名字 $1 是传递给该shell的第一个参数 $2 是传递给该shell的第二个参数 $@ 是传递 ...

  3. IIS 管理器无法验证此内置帐户是否有访问权

    解决办法:1.打开iss管理器2.点击网站——localhost3.点击右上角位置的"基本设置"——"链接为"——"特定用户"——" ...

  4. 如何查看2to3.PY的帮助文档

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #如何查看2to3.PY的帮助文档 #http://tieba.baidu.com/p/3939904893 ...

  5. mybatis中模糊查询的使用以及一些细节问题的注意事项

    页面有个功能 为 根据 品牌名进行 关键字查询,对应到数据库的是brand表的name字段的模糊查询 如果用的是SSM框架,在mybatis中我们需要自己写sql语句,涉及到like的模糊查询,myb ...

  6. CSS“隐藏”元素的几种方法的对比

    本文地址:http://luopq.com/2016/02/15/css-tricks-of-hide-element/,转载请注明 一说起CSS隐藏元素,我想大部分小伙伴们都会想到的第一种方法就是设 ...

  7. Android的Button按钮,ACTION_UP事件不触发解决方案

           在android 编程时,有时候要实现当Button一直按下的时候,执行一些逻辑代码,当按钮弹起的时候,终止这些逻辑代码的执行.      比如在 设置页面的滑动开关时,如果不监听ACT ...

  8. Linux-socket的close和shutdown区别及应用场景

    shutdown的定义 #include<sys/socket.h> int shutdown(int sockfd,int how); how的方式有三种分别是: SHUT_RD(0): ...

  9. 听听各位对Ubuntu的UI的看法

    2012-7-15 15:46    最近升级到Ubuntu 12.4 .发现其界面效果真的时越来越炫啦.我就在想,你Ubuntu你图什么啊, 你是以个Linux系统,你的重点在于让系统运行更稳定,更 ...

  10. [抄]使用网页进行展示而非PPT

    会议.演讲离不开幻灯片,它可以有效地辅助演讲者进行表达.目前一些流行的工具,比如Windows平台上的PowerPoint.Mac平台上的Keynote等工具,使得幻灯片的制作变得简单.但是这些幻灯片 ...