-
Notifications
You must be signed in to change notification settings - Fork 18
/
logstash-atop.conf
223 lines (187 loc) · 7.49 KB
/
logstash-atop.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#
# A data importer for the atop(1) utility, see http://www.atoptool.nl/
#
# Take your daily files, and pass through the reporting tool.
#
# $ atop -r /var/log/atop.log -P CPU,CPL,MEM,SWP,PAG,DSK,NET,PRM,PRC,PRD | logstash -f logstash-atop.conf
#
# Note: more report types will need parsers; please commit back.
#
# See output stanza at the bottom to control where the output goes; default
# rubydebug stdout.
#
input { stdin { } }
filter {
mutate { replace => { "type" => "atop" } }
grok {
# PRM aws-etp-appc1n1p 1404732327 2014/07/07 11:25:27 600 2225 (uname) E 4096 0 0 0 0 0 232 0
# First six fields
# label (the name of the label),
# host (the name of this machine),
# epoch (the time of this interval as number of seconds since 1-1-1970),
# date (date of this interval in format YYYY/MM/DD),
# time (time of this interval in format HH:MM:SS), and
# interval (number of seconds elapsed for this interval)
match => {
"message" => [
"%{DATA:label} %{DATA:server} %{NUMBER:timestamp:int} %{DATA:date} %{DATA:time} %{NUMBER:atop_interval:int} %{GREEDYDATA:data}"
]
}
}
date {
match => [ timestamp, "UNIX" ]
}
if [label] == "PRC" {
grok {
# PRC:
# Example: 1 (init) S 100 12544 23519 0 120 0 0 0 0
# PID, name (between brackets), state,
# total number of clock-ticks per second,
# CPU-consumption in user mode (clockticks),
# CPU-consumption in system mode (clockticks),
# nice value,
# priority,
# realtime priority,
# scheduling policy,
# current CPU, and sleep average
match => {
"message" => [
"%{NUMBER:pid:int} \(%{DATA:proc_name}\) %{DATA:proc_state} %{NUMBER:proc_ticks_ps:int} %{NUMBER:proc_usr_ticks_ps:int} %{NUMBER:proc_sys_ticks_ps:int} %{NUMBER:proc_nice:int} %{NUMBER:proc_prio:int} %{NUMBER:proc_rprio:int} %{NUMBER:proc_sprio:int} %{NUMBER:proc_curr_cpu:int} %{NUMBER:proc_sleep_avg:int}"
]
}
add_tag => [ PRC ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "PRM" {
grok {
# PRM:
# Example: 9 (khelper) S 4096 0 0 0 0 0 0 0
# PID, name, state, page_size, vsize, rss, shared, vm_growth, rss_growth, minor, major
match => {
"message" => [
"%{NUMBER:pid:int} \(%{DATA:proc_name}\) %{DATA:proc_state} %{NUMBER:proc_page_size:int} %{NUMBER:proc_vsize:int} %{NUMBER:proc_rss:int} %{NUMBER:proc_shared:int} %{NUMBER:proc_vm_growth:int} %{NUMBER:proc_rss_growth:int} %{NUMBER:proc_minor:int} %{NUMBER:proc_major:int}"
]
}
add_tag => [ PRM ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "PRD" {
grok {
# PRD:
# Example: 891 (whoopsie) S n y 2144 2144 0 0 0
# PID, name, state, kernel_patch, standard_stats, reads, sreads, writes, swrites, cwrites
match => {
"message" => [
"%{NUMBER:pid:int} \(%{DATA:proc_name}\) %{DATA:proc_state} %{DATA:proc_kernel_patch} %{DATA:proc_standard_stats} %{NUMBER:proc_reads:int} %{NUMBER:proc_sreads:int} %{NUMBER:proc_writes:int} %{NUMBER:proc_swrites:int} %{NUMBER:proc_cwrites:int}"
]
}
add_tag => [ PRD ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "CPU" {
grok {
# CPU:
# Example: 100 1 1059 4891 113 52647 352 1 94 591 0 2666 100
# ticks_ps, cpus, sys_ticks, usr_ticks, nice_ticks, idle_ticks, wait_ticks, irq_ticks, softirq_ticks, steal_ticks, guest_ticks, ?, ?
match => {
"message" => [
"%{NUMBER:ticks_ps:int} %{NUMBER:cpus:int} %{NUMBER:sys_ticks:int} %{NUMBER:usr_ticks:int} %{NUMBER:nice_ticks:int} %{NUMBER:idle_ticks:int} %{NUMBER:wait_ticks:int} %{NUMBER:irq_ticks:int} %{NUMBER:softirq_ticks:int} %{NUMBER:steal_ticks:int} %{NUMBER:guest_ticks:int} %{NUMBER:field1:int} %{NUMBER:field2:int}"
]
}
add_tag => [ CPU ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "CPL" {
grok {
# CPL:
# Example: 1 1.38 0.71 0.38 1215481837 959421136
# cpus, la1, la5, la15, ctxsw, devintr
match => {
"message" => [
"%{NUMBER:cpus:int} %{NUMBER:la1:float} %{NUMBER:la5:float} %{NUMBER:la15:float} %{NUMBER:ctxsw:int} %{NUMBER:devintr:int}"
]
}
add_tag => [ CPL ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "MEM" {
grok {
# MEM:
# Example: 4096 960111 163179 238531 56255 36584 136
# page_size, total, free, page_cache, buff_cache, slab, dirty
match => {
"message" => [
"%{NUMBER:page_size:int} %{NUMBER:mem_total:int} %{NUMBER:mem_free:int} %{NUMBER:page_cache:int} %{NUMBER:buffer_cache:int} %{NUMBER:slab:int} %{NUMBER:mem_dirty:int}"
]
}
add_tag => [ MEM ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "SWP" {
grok {
# SWP:
# Example: 4096 786431 786431 0 603616 1266486
# page_size, swp_total, swp_free, future, commit, limit
match => {
"message" => [
"%{NUMBER:swp_page_size:int} %{NUMBER:swp_total:int} %{NUMBER:swp_free:int} %{NUMBER:swp_future:int} %{NUMBER:swp_commit:int} %{NUMBER:swp_limit:int}"
]
}
add_tag => [ SWP ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "PAG" {
grok {
# PAG:
# Example: 4096 0 0 0 0 0
# page_size, page_scans, page_stalls, page_future, swapins, swapouts
match => {
"message" => [
"%{NUMBER:pag_page_size:int} %{NUMBER:pag_scans:int} %{NUMBER:pag_stalls:int} %{NUMBER:pag_future:int} %{NUMBER:pag_swapins:int} %{NUMBER:pag_swapouts:int}"
]
}
add_tag => [ PAG ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "DSK" {
grok {
# DSK:
# Example: xvdb 124 0 0 296 8968
# dsk_name, dsk_io_ms, dsk_reads, dsk_rsects, dsk_writes, dsk_wsects
match => {
"message" => [
"%{NOTSPACE:dsk_name} %{NUMBER:dsk_io_ms:int} %{NUMBER:dsk_reads:int} %{NUMBER:dsk_rsects:int} %{NUMBER:dsk_writes:int} %{NUMBER:dsk_wsects:int}"
]
}
add_tag => [ DSK, "%{dsk_name}" ]
remove_tag => [ _grokparsefailure ]
}
}
if [label] == "NET" {
grok {
# NET:
# upper 839738384 814041074 13586823 19443302 853325704 629519325 853325702 0
# eth0 664989469 532135642950 441183088 407091251692 0 0
match => {
"message" => [
"%{NOTSPACE:if_name} %{NUMBER:net_packets_recv_tcp:int} %{NUMBER:net_packets_sent_tcp:int} %{NUMBER:net_packets_recv_udp:int} %{NUMBER:net_packets_sent_udp:int} %{NUMBER:net_packets_recv_ip:int} %{NUMBER:net_packets_sent_ip:int} %{NUMBER:net_packets_delivered_ip:int} %{NUMBER:net_packets_fwd_ip:int}",
"%{NOTSPACE:if_name} %{NUMBER:net_packets_recv:int} %{NUMBER:net_bytes_recv:int} %{NUMBER:net_packets_sent:int} %{NUMBER:net_bytes_sent:int} %{NUMBER:net_speed:int} %{NUMBER:net_duplex:int}"
]
}
add_tag => [ NET, "%{if_name}" ]
remove_tag => [ _grokparsefailure ]
}
}
}
output {
# elasticsearch { host => localhost }
stdout { codec => rubydebug }
}