温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Heka同一个文件滚动读取rolling read FilePollingInput的示例分析

发布时间:2021-12-16 16:19:34 来源:亿速云 阅读:117 作者:小新 栏目:云计算

这篇文章主要为大家展示了“Heka同一个文件滚动读取rolling read FilePollingInput的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Heka同一个文件滚动读取rolling read FilePollingInput的示例分析”这篇文章吧。

针对一个文件,周期性质的去读取内容,无buffer的读取,典型应用

1,内存使用情况读取

[hekad]
maxprocs = 2

[MemStats]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/meminfo"
decoder = "MemStatsDecoder"


[MemStatsDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_memstats.lua"


[RstEncoder]

[LogOutput]
message_matcher = "TRUE"
encoder = "RstEncoder"

结果如下,

:Timestamp: 2016-07-22 10:29:48 +0000 UTC
:Type: stats.memstats
:Hostname: master
:Pid: 0
:Uuid: 977fd381-43d8-424a-a410-8d230b85ab46
:Logger: MemStats
:Payload: 
:EnvVersion: 
:Severity: 7
:Fields:
    | name:"Hugepagesize" type:double value:2048 representation:"kB"
    | name:"Buffers" type:double value:183108 representation:"kB"
    | name:"Active" type:double value:696196 representation:"kB"
    | name:"Bounce" type:double value:0 representation:"kB"
    | name:"SUnreclaim" type:double value:31416 representation:"kB"
    | name:"HugePages_Total" type:double value:0
    | name:"Active(anon)" type:double value:454064 representation:"kB"
    | name:"Mlocked" type:double value:0 representation:"kB"
    | name:"AnonPages" type:double value:981512 representation:"kB"
    | name:"Active(file)" type:double value:242132 representation:"kB"
    | name:"Committed_AS" type:double value:3.152928e+06 representation:"kB"
    | name:"VmallocUsed" type:double value:149148 representation:"kB"
    | name:"SwapFree" type:double value:2.009828e+06 representation:"kB"
    | name:"Inactive(file)" type:double value:313540 representation:"kB"
    | name:"CommitLimit" type:double value:2.988856e+06 representation:"kB"
    | name:"Slab" type:double value:164308 representation:"kB"
    | name:"PageTables" type:double value:16888 representation:"kB"
    | name:"HugePages_Free" type:double value:0
    | name:"SwapTotal" type:double value:2.031608e+06 representation:"kB"
    | name:"NFS_Unstable" type:double value:0 representation:"kB"
    | name:"VmallocChunk" type:double value:3.4359583224e+10 representation:"kB"
    | name:"HugePages_Surp" type:double value:0
    | name:"DirectMap1G" type:double value:0 representation:"kB"
    | name:"DirectMap2M" type:double value:2.091008e+06 representation:"kB"
    | name:"DirectMap4k" type:double value:6144 representation:"kB"
    | name:"HugePages_Rsvd" type:double value:0
    | name:"Shmem" type:double value:1164 representation:"kB"
    | name:"SReclaimable" type:double value:132892 representation:"kB"
    | name:"Mapped" type:double value:57724 representation:"kB"
    | name:"HardwareCorrupted" type:double value:0 representation:"kB"
    | name:"FilePath" type:string value:"/proc/meminfo"
    | name:"MemFree" type:double value:159100 representation:"kB"
    | name:"Writeback" type:double value:0 representation:"kB"
    | name:"SwapCached" type:double value:3240 representation:"kB"
    | name:"WritebackTmp" type:double value:0 representation:"kB"
    | name:"Dirty" type:double value:164 representation:"kB"
    | name:"VmallocTotal" type:double value:3.4359738367e+10 representation:"kB"
    | name:"Inactive" type:double value:844780 representation:"kB"
    | name:"AnonHugePages" type:double value:706560 representation:"kB"
    | name:"Unevictable" type:double value:0 representation:"kB"
    | name:"Inactive(anon)" type:double value:531240 representation:"kB"
    | name:"KernelStack" type:double value:3128 representation:"kB"
    | name:"Cached" type:double value:373728 representation:"kB"
    | name:"MemTotal" type:double value:1.914496e+06 representation:"kB"

fileds中的值会随着每次读取发生变化的。

应用二,系统负载读取

[LoadAvg]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/loadavg"
decoder = "LoadAvgDecoder"

[LoadAvgDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_loadavg.lua"

应用三,磁盘情况读取

[DiskStats]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/sys/block/sda1/stat"
decoder = "DiskStatsDecoder"

[DiskStatsDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_diskstats.lua"

应用四,cpu情况读取

[ProcStats]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/stat"
decoder = "ProcStatDecoder"

[ProcStatDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_procstat.lua"

应用五,设备情况读取

[Netdev]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/net/dev"
decoder = "NetdevDecoder"

[NetdevDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_netdev.lua"

应用六,网络情况读取

[NetNetstat]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/net/netstat"
decoder = "NetstatDecoder"

[NetSnmp]
type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/net/snmp"
decoder = "NetstatDecoder"

[NetstatDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_netstat.lua"

以上是“Heka同一个文件滚动读取rolling read FilePollingInput的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI