This repository has been archived by the owner on Dec 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlogstash.conf.m4
51 lines (51 loc) · 1.66 KB
/
logstash.conf.m4
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
input {
cloudflare {
auth_email => "CF_AUTH_EMAIL"
auth_key => "CF_AUTH_KEY"
domain => "CF_DOMAIN"
type => "cloudflare_logs"
poll_time => 15
poll_interval => 120
metadata_filepath => "/logstash-input-cloudflare/cf_metadata.json"
fields => [
'timestamp', 'zoneId', 'ownerId', 'zoneName', 'rayId', 'securityLevel',
'client.ip', 'client.country', 'client.sslProtocol', 'client.sslCipher',
'client.deviceType', 'client.asNum', 'clientRequest.bytes',
'clientRequest.httpHost', 'clientRequest.httpMethod', 'clientRequest.uri',
'clientRequest.httpProtocol', 'clientRequest.userAgent', 'cache.cacheStatus',
'edge.cacheResponseTime', 'edge.startTimestamp', 'edge.endTimestamp',
'edgeResponse.status', 'edgeResponse.bytes', 'edgeResponse.bodyBytes',
'originResponse.status', 'origin.responseTime'
]
}
}
output {
elasticsearch {
hosts => ["esserver:9200"]
index => "logstash-%{+YYYY.MM.dd}"
doc_as_upsert => true
document_id => "%{rayId}"
template_overwrite => true
}
}
filter {
ruby {
code => "event['timestamp_ms'] = event['timestamp'] / 1_000_000"
remove_field => [ 'timestamp' ]
}
ruby {
code => "event['edge_requestTime'] = (event['edge_endTimestamp'] - event['edge_startTimestamp']).to_f / 1_000_000_000"
}
ruby {
code => "event['edgeResponse_headerBytes'] = event['edgeResponse_bytes'].to_i - event['edgeResponse_bodyBytes'].to_i"
}
date {
match => [ "timestamp_ms", "UNIX_MS" ]
}
geoip {
source => "client_ip"
}
useragent {
source => "clientRequest.userAgent"
}
}