logstash-codec-google_appengine 1.10.0 → 1.11.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: 77d4a1ef7e15934b7ddea3bf376306d074f5def7
|
4
|
+
data.tar.gz: 22f26fa78986bd8115c9b71368f4ee8b543e3df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51f5f16d825d82820364b0cc07d5059d5cdaaaeb9aed790245b850382f14b1180750da2161c08800f8fdbdec622c8280ef387f8d52e427950372c4a082cac3e1
|
7
|
+
data.tar.gz: 36d1de93d54a0253afabcd02582fc7e1c7dbee77e2ea8d3f5930392df632086a2ff791e65eb8b67f3d95d21c0d722056748ea113ca546389fd0c56f85084f958
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require "logstash/codecs/base"
|
3
3
|
require "logstash/namespace"
|
4
4
|
require "logstash/codecs/json"
|
5
|
-
require '
|
5
|
+
require 'digest'
|
6
6
|
|
7
7
|
class LogStash::Codecs::GoogleAppengine < LogStash::Codecs::Base
|
8
8
|
config_name "google_appengine"
|
@@ -11,6 +11,7 @@ class LogStash::Codecs::GoogleAppengine < LogStash::Codecs::Base
|
|
11
11
|
|
12
12
|
def register
|
13
13
|
@json = LogStash::Codecs::JSON.new
|
14
|
+
@md5 = Digest::MD5.new
|
14
15
|
end
|
15
16
|
|
16
17
|
def decode(data)
|
@@ -41,17 +42,18 @@ def flatten(event)
|
|
41
42
|
lines = payload['line']
|
42
43
|
|
43
44
|
payload.delete '@type'
|
44
|
-
|
45
|
+
|
45
46
|
|
46
47
|
if lines
|
47
48
|
payload.delete 'line'
|
48
49
|
lines.map.with_index { |line, i|
|
49
50
|
merged = payload.merge line
|
50
|
-
merged['id'] = merged['
|
51
|
+
merged['id'] = @md5.hexdigest merged['requestId'] + i.to_s
|
51
52
|
merged['message'] = merged.delete 'logMessage'
|
52
53
|
merged
|
53
54
|
}
|
54
55
|
else
|
56
|
+
payload['id'] = @md5.hexdigest payload['requestId']
|
55
57
|
payload['time'] = payload['endTime']
|
56
58
|
[payload]
|
57
59
|
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.11.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"
|
@@ -3,6 +3,7 @@ require "logstash/codecs/google_appengine"
|
|
3
3
|
require "logstash/event"
|
4
4
|
require "logstash/json"
|
5
5
|
require "insist"
|
6
|
+
require 'digest'
|
6
7
|
|
7
8
|
describe LogStash::Codecs::GoogleAppengine do
|
8
9
|
subject do
|
@@ -12,6 +13,7 @@ describe LogStash::Codecs::GoogleAppengine do
|
|
12
13
|
|
13
14
|
|
14
15
|
context "#decode" do
|
16
|
+
md5 = Digest::MD5.new
|
15
17
|
|
16
18
|
it "should return an event from json data" do
|
17
19
|
data = File.open("spec/codecs/appengine.logs.jsonl", "rb").read
|
@@ -31,11 +33,11 @@ context "#decode" do
|
|
31
33
|
expect(collector.size).to eq(3)
|
32
34
|
|
33
35
|
expect(collector[0]["message"]).to eq("IdentityFilter logUserIdentity: [[meta]] <anonymous:true>\n")
|
34
|
-
expect(collector[0]["id"]).to eq(collector[0]["requestId"] + "0")
|
36
|
+
expect(collector[0]["id"]).to eq(md5.hexdigest collector[0]["requestId"] + "0")
|
35
37
|
expect(collector[0]["@type"]).to be_nil
|
36
38
|
|
37
39
|
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")
|
40
|
+
expect(collector[1]["id"]).to eq(md5.hexdigest collector[1]["requestId"] + "1")
|
39
41
|
expect(collector[1]["@type"]).to be_nil
|
40
42
|
end
|
41
43
|
|
@@ -52,7 +54,7 @@ context "#decode" do
|
|
52
54
|
expect(collector.size).to eq(1)
|
53
55
|
|
54
56
|
expect(collector[0]["resource"]).to eq("/images/website/welcome/keyFeatures/objectives.jpg")
|
55
|
-
expect(collector[0]["id"]).to eq(collector[0]["requestId"])
|
57
|
+
expect(collector[0]["id"]).to eq(md5.hexdigest collector[0]["requestId"])
|
56
58
|
expect(collector[0]["time"]).to eq(collector[0]["endTime"])
|
57
59
|
expect(collector[0]["@type"]).to be_nil
|
58
60
|
end
|