Nginx Collectd Tail插件如何处理日志文件旋转?

Nginx Collectd Tail插件如何处理日志文件旋转?,nginx,plugins,tail,collectd,Nginx,Plugins,Tail,Collectd,我已经在Nginx实例上安装了Collectd,并使用它来计算HTTP状态代码。当前Collectd配置如下所示: Hostname "localhost" FQDNLookup false BaseDir "/var/lib/collectd" PluginDir "/usr/lib/collectd" TypesDB "/usr/share/collectd/types.db" AutoLoadPlugin true Interval 30 MaxReadInterval 86400

我已经在Nginx实例上安装了Collectd,并使用它来计算HTTP状态代码。当前Collectd配置如下所示:

Hostname "localhost"
FQDNLookup false
BaseDir "/var/lib/collectd"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"

AutoLoadPlugin true

Interval 30

MaxReadInterval 86400
Timeout 2
ReadThreads 5
WriteThreads 5

<Plugin "logfile">
  LogLevel "info"
  File "/var/log/collectd.log"
  Timestamp true
</Plugin>

<Plugin "tail">
    <File "/var/log/nginx/access.log">
      Instance "prod1_nginx"
      <Match>
        Regex "HTTP/1..\" 2[0-9]{2}"
        DSType "CounterInc"
        Type "counter"
        Instance "prod1_nginx_2xx"
      </Match>
      <Match>
        Regex "HTTP/1..\" 3[0-9]{2}"
        DSType "CounterInc"
        Type "counter"
        Instance "prod1_nginx_3xx"
      </Match>
      <Match>
        Regex "HTTP/1..\" 4[0-9]{2}"
        DSType "CounterInc"
        Type "counter"
        Instance "prod1_nginx_4xx"
      </Match>
      <Match>
        Regex "HTTP/1..\" 5[0-9]{2}"
        DSType "CounterInc"
        Type "counter"
        Instance "prod1_nginx_5xx"
      </Match>
    </File>
</Plugin>

<Plugin "network">
  Server "INFLUX_DB_IP" "25826"
</Plugin>
Hostname“localhost”
FQDNLookup false
BaseDir“/var/lib/collectd”
PluginDir“/usr/lib/collectd”
TypesDB“/usr/share/collectd/types.db”
自体凝集素
间隔30
最大读取间隔86400
超时2
读线程5
写读5
日志级别“信息”
文件“/var/log/collectd.log”
时间戳真
实例“prod1\u nginx”
正则表达式“HTTP/1..\“2[0-9]{2}”
DSType“CounterInc”
输入“计数器”
实例“prod1\u nginx\u 2xx”
正则表达式“HTTP/1..\“3[0-9]{2}”
DSType“CounterInc”
输入“计数器”
实例“prod1\u nginx\u 3xx”
正则表达式“HTTP/1..\“4[0-9]{2}”
DSType“CounterInc”
输入“计数器”
实例“prod1\u nginx\u 4xx”
正则表达式“HTTP/1..\“5[0-9]{2}”
DSType“CounterInc”
输入“计数器”
实例“prod1\u nginx\u 5xx”
服务器“流入数据库IP”25826
这个配置并不完美,我仍在诊断其他问题,但现在我想了解在旋转Nginx日志文件时Collectd将如何工作

现在发生的是,当文件被旋转时,Nginx将向旋转后的文件写入数据,直到Nginx被重新加载,这是正常的行为。但此时,Collectd将度量报告为0。如何使Collectd文件旋转感知