fluent-plugin-cloudfront-log-optimized 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbbdcfd3c3c07b1d9d8f8f6dd0a16d13a788e6b87210f91b33e48536e5cf5ee9
|
|
4
|
+
data.tar.gz: 4418c4f338ca6bcd5718728ce79a6293263dece6e20d12472e65e0548601ad71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e44f3a6d3a2cf65a45a2cf5c106bbbec9c62376cc03477541c168f82b649698e1f9480ae03410528fe351481b91bde9ebf42880ef07191a1bedf3197d34e8a7
|
|
7
|
+
data.tar.gz: ce1791412ff7169171be180d79e350bddf336e06fa3801c9ed5138513d656ccdb06f0c621a589e445ae59fda1f6262d0cd53e7fe9309678981580ae8822f2cc3
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
ARG RUBY_VERSION=2.7.6
|
|
2
|
+
ARG RUBYGEMS_UPDATE_VERSION=1.8.30
|
|
3
|
+
ARG BUNDLER_VERSION=1.7.15
|
|
4
|
+
|
|
5
|
+
FROM ruby:$RUBY_VERSION-slim
|
|
6
|
+
LABEL maintainer="k.j.wierenga@kerkdienstgemist.nl"
|
|
7
|
+
|
|
8
|
+
# Common dependencies
|
|
9
|
+
# Install apt based dependencies required to run Rails as
|
|
10
|
+
# well as RubyGems. As the Ruby image itself is based on a
|
|
11
|
+
# Debian image, we use apt-get to install those.
|
|
12
|
+
RUN apt-get update -qq \
|
|
13
|
+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
14
|
+
build-essential \
|
|
15
|
+
git \
|
|
16
|
+
&& apt-get clean \
|
|
17
|
+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
|
18
|
+
&& truncate -s 0 /var/log/*log
|
|
19
|
+
|
|
20
|
+
# Configure bundler
|
|
21
|
+
ENV LANG=C.UTF-8 \
|
|
22
|
+
BUNDLE_JOBS=4 \
|
|
23
|
+
BUNDLE_RETRY=3
|
|
24
|
+
|
|
25
|
+
# Uncomment this line if you store Bundler settings in the project's root
|
|
26
|
+
# ENV BUNDLE_APP_CONFIG=.bundle
|
|
27
|
+
|
|
28
|
+
# Uncomment this line if you want to run binstubs without prefixing with `bin/` or `bundle exec`
|
|
29
|
+
# ENV PATH /app/bin:$PATH
|
|
30
|
+
|
|
31
|
+
# Upgrade RubyGems and install required Bundler version
|
|
32
|
+
# ARG BUNDLER_VERSION
|
|
33
|
+
# ARG RUBYGEMS_UPDATE_VERSION
|
|
34
|
+
# RUN gem uninstall bundler && \
|
|
35
|
+
# gem update --system $RUBYGEMS_UPDATE_VERSION && \
|
|
36
|
+
# gem install bundler:$BUNDLER_VERSION
|
|
37
|
+
|
|
38
|
+
# Configure the main working directory. This is the base
|
|
39
|
+
# directory used in any further RUN, COPY, and ENTRYPOINT commands.
|
|
40
|
+
ENV WORKDIR=/app
|
|
41
|
+
RUN mkdir -p $WORKDIR
|
|
42
|
+
WORKDIR $WORKDIR
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
|
3
|
+
{
|
|
4
|
+
"name": "Ruby",
|
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
|
+
// "image": "ruby:2.7.6-slim"
|
|
7
|
+
"build": {
|
|
8
|
+
// Path is relative to the devcontainer.json file.
|
|
9
|
+
"dockerfile": "Dockerfile"
|
|
10
|
+
}
|
|
11
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
12
|
+
// "features": {},
|
|
13
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
14
|
+
// "forwardPorts": [],
|
|
15
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
16
|
+
// "postCreateCommand": "ruby --version",
|
|
17
|
+
// Configure tool-specific properties.
|
|
18
|
+
// "customizations": {},
|
|
19
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
20
|
+
// "remoteUser": "root"
|
|
21
|
+
}
|
data/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "fluent-plugin-cloudfront-log-optimized"
|
|
7
|
-
spec.version = "0.2.
|
|
7
|
+
spec.version = "0.2.1"
|
|
8
8
|
spec.authors = ["kubihee", "lenfree", "kjwierenga"]
|
|
9
9
|
spec.email = ["kubihie@gmail.com", "lenfree.yeung@gmail.com", "k.j.wierenga@gmail.com"]
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.add_dependency "fluentd", ">= 0.14.0", "< 2"
|
|
21
21
|
spec.add_dependency "aws-sdk-s3", "~> 1"
|
|
22
22
|
spec.add_dependency "aws-sdk-sqs", "~> 1"
|
|
23
|
-
spec.add_development_dependency "bundler", "~>
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
24
24
|
spec.add_development_dependency "rake", "~> 12"
|
|
25
25
|
spec.add_development_dependency 'test-unit', "~> 2"
|
|
26
26
|
end
|
|
@@ -134,16 +134,18 @@ class Fluent::Cloudfront_LogInput < Fluent::Input
|
|
|
134
134
|
|
|
135
135
|
record = [
|
|
136
136
|
@fields,
|
|
137
|
-
CGI.unescape(line).strip.split("\t") #
|
|
137
|
+
CGI.unescape(line.gsub('%09', ' ')).strip.split("\t") # don't unescape tab (%09)
|
|
138
138
|
].transpose.to_h
|
|
139
139
|
|
|
140
140
|
timestamp = if @parse_date_time
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
Time.iso8601("#{record['date']}T#{record['time']}+00:00").to_i
|
|
142
|
+
else
|
|
143
|
+
Time.now.to_i
|
|
144
|
+
end
|
|
145
145
|
|
|
146
146
|
router.emit(@tag, timestamp, record)
|
|
147
|
+
|
|
148
|
+
record # for testing purposes
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
def process_content(content)
|
|
@@ -105,4 +105,22 @@ class Cloudfront_LogInputTest < Test::Unit::TestCase
|
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
sub_test_case "regression test for %09 (tab) in log lines" do
|
|
109
|
+
test "log line with %09 in user-agent is parsed correctly" do
|
|
110
|
+
driver = create_driver(MINIMAL_CONFIG)
|
|
111
|
+
instance = driver.instance
|
|
112
|
+
|
|
113
|
+
version_line = "#Version: 1.0"
|
|
114
|
+
fields_line = "#Fields: date time x-edge-location sc-bytes c-ip cs-method cs(Host) cs-uri-stem sc-status cs(Referer) cs(User-Agent) cs-uri-query cs(Cookie) x-edge-result-type x-edge-request-id x-host-header cs-protocol cs-bytes time-taken x-forwarded-for ssl-protocol ssl-cipher x-edge-response-result-type cs-protocol-version fle-status fle-encrypted-fields c-port time-to-first-byte x-edge-detailed-result-type sc-content-type sc-content-len sc-range-start sc-range-end"
|
|
115
|
+
regression_line_with_excaped_tab = "2025-10-12 09:52:59 MRS53-P3 1400 150.107.232.112 POST d2p1j3y3mcauy0.cloudfront.net /plugin/add 403 - Mozilla/5.0%20(Macintosh;%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit/605.1.15%20(KHTML,%20like%20Gecko)%20Version/17.3.1%20Safari/605.1.1%0920.51 - - Error WcPCNG0WyL4BbXhEXq4AQulhrqte2TPUHt1Uz-iqcSwtx1L6ORdTOA== livecdn.kerkdienstgemist.nl https 9760 0.124 - TLSv1.3 TLS_AES_128_GCM_SHA256 Error HTTP/1.1 - - 50294 0.000 InvalidRequestMethod text/html 1053 - -"
|
|
116
|
+
|
|
117
|
+
# Prime the processor with version and fields lines
|
|
118
|
+
instance.process_line(version_line)
|
|
119
|
+
instance.process_line(fields_line)
|
|
120
|
+
emitted_event = instance.process_line(regression_line_with_excaped_tab)
|
|
121
|
+
|
|
122
|
+
assert_equal(emitted_event['cs(User-Agent)'], "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.1 20.51")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
108
126
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-cloudfront-log-optimized
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kubihee
|
|
8
8
|
- lenfree
|
|
9
9
|
- kjwierenga
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2025-10-24 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: fluentd
|
|
@@ -66,14 +66,14 @@ dependencies:
|
|
|
66
66
|
requirements:
|
|
67
67
|
- - "~>"
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
69
|
+
version: '2.0'
|
|
70
70
|
type: :development
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
|
74
74
|
- - "~>"
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '
|
|
76
|
+
version: '2.0'
|
|
77
77
|
- !ruby/object:Gem::Dependency
|
|
78
78
|
name: rake
|
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -111,6 +111,8 @@ executables: []
|
|
|
111
111
|
extensions: []
|
|
112
112
|
extra_rdoc_files: []
|
|
113
113
|
files:
|
|
114
|
+
- ".devcontainer/Dockerfile"
|
|
115
|
+
- ".devcontainer/devcontainer.json"
|
|
114
116
|
- ".gitignore"
|
|
115
117
|
- CHANGELOG.md
|
|
116
118
|
- Gemfile
|
|
@@ -124,7 +126,7 @@ files:
|
|
|
124
126
|
homepage: https://github.com/kjwierenga/fluent-plugin-cloudfront-log-optimized
|
|
125
127
|
licenses: []
|
|
126
128
|
metadata: {}
|
|
127
|
-
post_install_message:
|
|
129
|
+
post_install_message:
|
|
128
130
|
rdoc_options: []
|
|
129
131
|
require_paths:
|
|
130
132
|
- lib
|
|
@@ -139,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
141
|
- !ruby/object:Gem::Version
|
|
140
142
|
version: '0'
|
|
141
143
|
requirements: []
|
|
142
|
-
rubygems_version: 3.
|
|
143
|
-
signing_key:
|
|
144
|
+
rubygems_version: 3.1.6
|
|
145
|
+
signing_key:
|
|
144
146
|
specification_version: 4
|
|
145
147
|
summary: AWS CloudFront log input plugin optimized for large log files. Credit to
|
|
146
148
|
kubihie and lenfree.
|