你可以的,加油

filebeat配置文件里面的paths路径可以设置为变量吗

Beats | 作者 lucky_girl | 发布于2017年05月08日 | 阅读数:9949

就是我的日志路径包括日期,比如:/mnt/server/backup/nginxlog/pc-load/2017/05/xx.log   
此处的路径,我不想写死,想根据日期自动变化,读取相应的日志,可以吗
如果不行,有什么比较好的方法吗
已邀请:

leighton_buaa

赞同来自:

try this:
/mnt/server/backup/nginxlog/pc-load/*/*.log

lucky_girl - 95 IT女

赞同来自:

但是我日志目录下面还有其他日期的文件,比如2016/01,..,2016/12 等等,时间太久了的日志不想去分析

xiaoke - http://blog.51cto.com/kexiaoke

赞同来自:

  # Ignore files which were modified more then the defined timespan in the past.
  # ignore_older is disabled by default, so no files are ignored by setting it to 0.
  # Time strings like 2h (2 hours), 5m (5 minutes) can be used.
  #ignore_older: 0
 
可以通过ignore_older参数排除掉多少小时以前的数据。

Wenbo Yang - https://www.linkedin.com/in/yangwenbo214

赞同来自:

假如你文件夹中有很多日志,子文件如
/2017/01/a.log
/2017/02/b.log
/2016/01/c.log
/2016/02/d/log
这个你直接路径写成/2017/*/*.log
这样不会读取你2016文件夹中的log了。

要回复问题请先登录注册