logstash-codec-google_appengine 1.7.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2b1bc67fc13ef96f2bb83e55e6495188c273113
|
4
|
+
data.tar.gz: 5b70cef5fe5e5e980474a6de5c471a5ca5d45d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2bc8f5341b32a0569103fa35f99dc90515d1ac8084042664c1ec7759eef4a6aef3455766f6ed2fa37e607003a770437158c2d75471daa7402625f7c54355aff
|
7
|
+
data.tar.gz: 850eb74ad21fdeb58be75805665d01917f987f24b0e31a7ef28c8f7e89e2447d38ae944484b081ce245f1229fc6e96c0d6d92cc96a1ad43e8899a7f1f85980cf
|
@@ -15,17 +15,17 @@ class LogStash::Codecs::GoogleAppengine < LogStash::Codecs::Base
|
|
15
15
|
|
16
16
|
def decode(data)
|
17
17
|
begin
|
18
|
-
@json.decode
|
19
|
-
if is_parse_failure
|
20
|
-
|
18
|
+
@json.decode data do |json|
|
19
|
+
if is_parse_failure json
|
20
|
+
@logger.error("Failed to process data", :data => json)
|
21
|
+
else
|
22
|
+
flatten(json).each { |flattenedJson|
|
23
|
+
yield LogStash::Event.new flattenedJson
|
24
|
+
}
|
21
25
|
end
|
22
|
-
|
23
|
-
flatten(json).each { |flattenedJson|
|
24
|
-
yield LogStash::Event.new(flattenedJson)
|
25
|
-
}
|
26
26
|
end
|
27
27
|
rescue => e
|
28
|
-
@logger.error
|
28
|
+
@logger.error "Failed to process data", :error => e, :data => data
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -39,17 +39,20 @@ end
|
|
39
39
|
def flatten(event)
|
40
40
|
payload = event['protoPayload']
|
41
41
|
lines = payload['line']
|
42
|
-
|
42
|
+
|
43
|
+
payload.delete '@type'
|
44
|
+
payload['id'] = payload['requestId']
|
45
|
+
|
43
46
|
if lines
|
44
|
-
payload.delete
|
47
|
+
payload.delete 'line'
|
45
48
|
lines.map.with_index { |line, i|
|
46
|
-
merged = payload.merge
|
47
|
-
merged['
|
49
|
+
merged = payload.merge line
|
50
|
+
merged['id'] = merged['id'] + i.to_s
|
51
|
+
merged['message'] = merged.delete 'logMessage'
|
48
52
|
merged
|
49
53
|
}
|
50
54
|
else
|
51
55
|
payload['time'] = payload['endTime']
|
52
|
-
payload['lineId'] = payload['requestId']
|
53
56
|
[payload]
|
54
57
|
end
|
55
58
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-google_appengine'
|
4
|
-
s.version = '1.
|
4
|
+
s.version = '1.10.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This codec may be used to decode via inputs appengine logs"
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
@@ -30,11 +30,13 @@ context "#decode" do
|
|
30
30
|
|
31
31
|
expect(collector.size).to eq(3)
|
32
32
|
|
33
|
-
expect(collector[0]["
|
34
|
-
expect(collector[0]["
|
33
|
+
expect(collector[0]["message"]).to eq("IdentityFilter logUserIdentity: [[meta]] <anonymous:true>\n")
|
34
|
+
expect(collector[0]["id"]).to eq(collector[0]["requestId"] + "0")
|
35
|
+
expect(collector[0]["@type"]).to be_nil
|
35
36
|
|
36
|
-
expect(collector[1]["
|
37
|
-
expect(collector[1]["
|
37
|
+
expect(collector[1]["message"]).to eq("HttpOnlyFilter getSession: add additional Set-Cookie with httpOnly-flag for JSESSIONID\n")
|
38
|
+
expect(collector[1]["id"]).to eq(collector[1]["requestId"] + "1")
|
39
|
+
expect(collector[1]["@type"]).to be_nil
|
38
40
|
end
|
39
41
|
|
40
42
|
it "should handle logs even when they have no lines" do
|
@@ -50,8 +52,9 @@ context "#decode" do
|
|
50
52
|
expect(collector.size).to eq(1)
|
51
53
|
|
52
54
|
expect(collector[0]["resource"]).to eq("/images/website/welcome/keyFeatures/objectives.jpg")
|
53
|
-
expect(collector[0]["
|
55
|
+
expect(collector[0]["id"]).to eq(collector[0]["requestId"])
|
54
56
|
expect(collector[0]["time"]).to eq(collector[0]["endTime"])
|
57
|
+
expect(collector[0]["@type"]).to be_nil
|
55
58
|
end
|
56
59
|
|
57
60
|
it "falls not emit an event when it can't be parsed" do
|