Create rolling monthly, weekly and daily Logstash indices
在刚刚开始接触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的更多相关文章
- log4j日志配置(按天/按日)
项目中尽管对log4j有基本的配置,例如按天生成日志文件以作区分,但如果系统日志文件过大,则就需要考虑以更小的单位切分或者其他切分方式.下面就总结一下log4j常用的配置参数以及切分日志的不同方式. ...
- [Java][log4j]支持同一时候按日期和文件大小切割日志
依据DailyRollingFileAppender和RollingFileAppender改编,支持按日期和文件大小切割日志. 源文件: package com.bao.logging; impo ...
- log4j配置参数详解——按日志文件大小、日期切分日志文件
项目中尽管对log4j有基本的配置,例如按天生成日志文件以作区分,但如果系统日志文件过大,则就需要考虑以更小的单位切分或者其他切分方式.下面就总结一下log4j常用的配置参数以及切分日志的不同方式. ...
- 【Logstash系列】使用Logstash作为收集端采集IIS日志
现阶段Logstash在Windows端的日志采集一直存在若干问题,包括: 1. LS有读锁:进程开启后Input指定路径下的所有文件都会被锁死无法重命名或删除. 2. LS不识别*:如果在pat ...
- logstash 对配置文件conf敏感信息,密码等加密
logstash的配置文件conf经常会涉及敏感信息,比如ES,mysql的账户密码等,以下使用logstash导入mysql为例子,加密隐藏mysql的密码. 在向keystore中添加key及其s ...
- matplot模块中的pylab
pylab的目的 Pylab combines the functionality of pyplot with the capabilities of NumPy in a single names ...
- Ansible简明使用手册
Ansible使用简明手册 1.简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric ...
- Oracle 调度程序(scheduler)摘自一位大神
在11g中,Oracle提供了一个新建的Scheduler特性,帮助将作业实现自动化.它还可以帮助你控制资源的利用与并可以将数据库中的作业按优先顺序执行.传统的dbms_jobs的一个限制是它只能调度 ...
- C# 添加系统计划任务方案
你可以在Windows 计划任务管理器里面添加计划任务,调试OK后导出XML文件,然后在要部署的计算机上执行CMD导入命令,把计划任务信息配置导入到服务器上的计划任务列表中,命令如下: SCHTASK ...
随机推荐
- eclipse/STS 提升注解提示速度
window -- preference -- 输入content -- java -- editor -- content Assist --auto delay 选项 改为100或者更低 提示速 ...
- 《Unix&Linux大学教程》学习笔记一:历史与常识
“为什么说Unix/Linux是自由的: 因为我们可以自己组装一个操作系统:Unix/Linux内核+其他实用工具+编程工具+GUI 因为我们可以自由地获取开源工作者 ...
- SSM实战——秒杀系统之Service层接口设计与实现、Spring托管、声明式事务
一:Service层接口设计 准备工作:新建三个包:service包.exception包.dto包,分别用来存放业务接口.自定义异常类.dto类. 1:定义接口 package org.myseck ...
- postgresql修改配置生效方法
对于配置服务器,,太多时候我们在Linux中做的操作是,配置*.conf文件,然后重启服务.而很多服务都具有reload功能,而但是具体到某个配置,有时候直接说出需不需要重启服务而使得配置生效,这并不 ...
- 解决ODI 12C Studio 运行缓慢问题
一.配置 ODI 12C Studio 1.1 修改ODI Studio process的-Xms和-Xmx ide.conf: modifying the initial Heap size (-X ...
- jqPlot图表插件学习之ajax-json数据加载
一.准备工作 首先我们需要到官网下载所需的文件: 官网下载(笔者选择的是jquery.jqplot.1.0.8r1250.zip这个版本) 然后读者需要根据自己的情况新建一个项目并且按照如下的方式加载 ...
- mysql在字符串中查找模式
查看以电话号码138开头的电话 select id, phone from user where phone like '138%'
- 转:D3DXVec3TransformNormal() 与 3DXVec3TransformCoord() 的区别
DirectX中有两个很相似的函数,输入与输出的参数格式完全一样,都是输入一个三维向量(D3DXVECTOR3)和一个矩阵(D3DXMATRIX),输出变换之后的向量(D3DXVECTOR3). 函数 ...
- 【Android开发经验】怎样查看android-support-v4支持包中的源代码
在support-v4包里面.加入了非常多的支持控件,比方ViewPager,Fragment等,为了解决一些问题,我们有时候想要看一下实现源代码,可是点进去之后.源代码并不会显示出来,会出现以下的情 ...
- Android开发环境——模拟器AVD相关内容汇总
Android开发环境将分为SDK相关内容.Eclipse ADT相关内容.模拟器AVD相关内容.调试器DDMS相关内容.日志LogCat相关内容.连接驱动ADB相关内容.内存泄露检测工具MAT相关 ...