fluent-plugin-fw1_loggrabber_parser 1.0.0 → 1.0.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 +5 -5
- data/.devcontainer/devcontainer.json +10 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/release.yml +47 -0
- data/.github/workflows/test.yml +27 -0
- data/.gitignore +58 -5
- data/.rspec +1 -1
- data/CHANGELOG.md +27 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +118 -32
- data/Rakefile +4 -0
- data/VERSION +1 -0
- data/fluent-plugin-fw1_loggrabber_parser.gemspec +22 -22
- data/lib/fluent/plugin/parser_fw1_loggrabber.rb +4 -2
- data/spec/fluent/plugin/parser_fw1_loggrabber_spec.rb +81 -0
- data/spec/spec_helper.rb +24 -0
- metadata +51 -41
- data/lib/fluent/plugin/parser_fw1_loggrabber/version.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8a0088466bbca18e3a09246bf8a7acc962c25b9c995fcdef5af5bce9763dcbad
|
|
4
|
+
data.tar.gz: b5bde0f48100d957bf047712dc10c01a3b88a6ba1e010c440563eca557966b29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85cff06e1cefd711a6e2896a2d656511724e02893f70df01a278e5afc36ec86d13752d269ec7bc89fb4d8c7a3780211d8866ffccd3f9724cfa3ca9d86d2c9fa1
|
|
7
|
+
data.tar.gz: ca58f9dd34b8ec7d0135da9431bf7f0475d76f30906b6a3fc1b930942b33d9b370f659f65f0ba6dc81d5c398b6cd9c32ed0b4df13eda9d8da29e7a5801288b8b
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes the gem to RubyGems.org via Trusted Publishing (OIDC) when a
|
|
4
|
+
# version tag such as v1.2.3 is pushed. No RubyGems API key is stored here.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
permissions: {}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
release:
|
|
14
|
+
name: Push gem to RubyGems.org
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
# Must match the environment configured for the trusted publisher on
|
|
17
|
+
# RubyGems.org.
|
|
18
|
+
environment: release
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
id-token: write # required to request the OIDC token for RubyGems.org
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
25
|
+
with:
|
|
26
|
+
persist-credentials: false
|
|
27
|
+
|
|
28
|
+
- name: Check that the tag matches VERSION
|
|
29
|
+
env:
|
|
30
|
+
TAG: ${{ github.ref_name }}
|
|
31
|
+
run: |
|
|
32
|
+
expected="v$(cat VERSION)"
|
|
33
|
+
if [ "$TAG" != "$expected" ]; then
|
|
34
|
+
echo "::error::Tag $TAG does not match VERSION ($expected)"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
- uses: ruby/setup-ruby@7eaac3fe3108dfb746bef3a3c1a21344d57923c7 # v1.348.0
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: ruby
|
|
41
|
+
bundler-cache: true
|
|
42
|
+
|
|
43
|
+
- name: Run specs
|
|
44
|
+
run: bundle exec rake spec
|
|
45
|
+
|
|
46
|
+
# The tag already exists, so `rake release` only builds and pushes the gem.
|
|
47
|
+
- uses: rubygems/release-gem@2654a0fe0dc39725c07fe84d7fe863a084f2424e # v1.5.0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
ruby: ["2.7", "3.1", "3.2", "3.3", "3.4", "4.0"]
|
|
18
|
+
name: Ruby ${{ matrix.ruby }}
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
- uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
|
24
|
+
bundler-cache: true
|
|
25
|
+
- run: bundle exec rake spec
|
|
26
|
+
env:
|
|
27
|
+
COVERAGE: "1"
|
data/.gitignore
CHANGED
|
@@ -1,9 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
# Created by https://www.gitignore.io/api/git,ruby
|
|
3
|
+
|
|
4
|
+
### Git ###
|
|
5
|
+
*.orig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Ruby ###
|
|
9
|
+
*.gem
|
|
10
|
+
*.rbc
|
|
11
|
+
/.config
|
|
5
12
|
/coverage/
|
|
6
|
-
/
|
|
13
|
+
/InstalledFiles
|
|
7
14
|
/pkg/
|
|
8
15
|
/spec/reports/
|
|
16
|
+
/spec/examples.txt
|
|
17
|
+
/test/tmp/
|
|
18
|
+
/test/version_tmp/
|
|
9
19
|
/tmp/
|
|
20
|
+
|
|
21
|
+
# Used by dotenv library to load environment variables.
|
|
22
|
+
.env
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion:
|
|
25
|
+
.dat*
|
|
26
|
+
.repl_history
|
|
27
|
+
build/
|
|
28
|
+
*.bridgesupport
|
|
29
|
+
build-iPhoneOS/
|
|
30
|
+
build-iPhoneSimulator/
|
|
31
|
+
|
|
32
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
33
|
+
#
|
|
34
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
35
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
36
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
37
|
+
#
|
|
38
|
+
vendor/Pods/
|
|
39
|
+
|
|
40
|
+
## Documentation cache and generated files:
|
|
41
|
+
/.yardoc/
|
|
42
|
+
/_yardoc/
|
|
43
|
+
/doc/
|
|
44
|
+
/rdoc/
|
|
45
|
+
|
|
46
|
+
## Environment normalization:
|
|
47
|
+
/.bundle/
|
|
48
|
+
/vendor/bundle
|
|
49
|
+
/lib/bundler/man/
|
|
50
|
+
|
|
51
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
52
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
53
|
+
Gemfile.lock
|
|
54
|
+
.ruby-version
|
|
55
|
+
.ruby-gemset
|
|
56
|
+
|
|
57
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
58
|
+
.rvmrc
|
|
59
|
+
|
|
60
|
+
# Local development
|
|
61
|
+
Gemfile.lock
|
|
62
|
+
/vendor/bundle
|
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## 1.0.1 - 2026-12-06
|
|
6
|
+
|
|
7
|
+
Maintenance only. Parsing behaviour is unchanged.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Declare `fluentd >= 0.12, < 2` as a runtime dependency and Ruby >= 2.7.
|
|
12
|
+
- Fix the gem metadata: homepage, source code and issue tracker links, and
|
|
13
|
+
the contact address.
|
|
14
|
+
- Keep the version in a `VERSION` file. The unused
|
|
15
|
+
`lib/fluent/plugin/parser_fw1_loggrabber/version.rb` is removed.
|
|
16
|
+
- Rewrite the README for Fluentd v1 (`<parse>` section, fluent-package).
|
|
17
|
+
- Move the specs to the Fluentd v1 test driver.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- GitHub Actions CI on Ruby 2.7 and 3.1 - 4.0, a release workflow using
|
|
22
|
+
RubyGems Trusted Publishing, and Dependabot for GitHub Actions.
|
|
23
|
+
- `LICENSE` file and a Dev Container for development.
|
|
24
|
+
|
|
25
|
+
## 1.0.0 - 2016-05-20
|
|
26
|
+
|
|
27
|
+
- Initial release.
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2016-2026 Tomoyuki Sugimura
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,32 +1,118 @@
|
|
|
1
|
-
# fluent-plugin-fw1_loggrabber_parser
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
https://github.com/
|
|
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
|
-
|
|
1
|
+
# fluent-plugin-fw1_loggrabber_parser
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/fluent-plugin-fw1_loggrabber_parser)
|
|
4
|
+
[](https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser/actions/workflows/test.yml)
|
|
5
|
+
[](https://rubygems.org/gems/fluent-plugin-fw1_loggrabber_parser)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
A [Fluentd](https://www.fluentd.org/) parser plugin for Check Point
|
|
9
|
+
FireWall-1 **LEA** logs written by
|
|
10
|
+
[FW1-LogGrabber](https://github.com/certego/fw1-loggrabber). It splits each
|
|
11
|
+
line into `key=value` pairs and turns them into record fields.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
| fluent-plugin-fw1_loggrabber_parser | fluentd | Ruby |
|
|
16
|
+
|-------------------------------------|-------------------|--------|
|
|
17
|
+
| >= 1.0.1 | v0.12.x - v1.x | >= 2.7 |
|
|
18
|
+
| 1.0.0 | v0.12.x - v1.x | - |
|
|
19
|
+
|
|
20
|
+
The 1.x series is tested against Fluentd v1 on Ruby 2.7 and 3.1 - 4.0.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# fluent-package (formerly td-agent)
|
|
26
|
+
sudo fluent-gem install fluent-plugin-fw1_loggrabber_parser
|
|
27
|
+
|
|
28
|
+
# plain Ruby / Bundler
|
|
29
|
+
gem install fluent-plugin-fw1_loggrabber_parser
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Official Fluentd container images and Helm charts do not include this plugin.
|
|
33
|
+
If you see `Unknown parser plugin 'fw1_loggrabber'`, install the gem in your
|
|
34
|
+
image, for example:
|
|
35
|
+
|
|
36
|
+
```dockerfile
|
|
37
|
+
FROM fluent/fluentd:v1.17-debian-1
|
|
38
|
+
USER root
|
|
39
|
+
RUN fluent-gem install fluent-plugin-fw1_loggrabber_parser
|
|
40
|
+
USER fluent
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Set `@type fw1_loggrabber` in a `<parse>` section, for example with `in_tail`:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
<source>
|
|
49
|
+
@type tail
|
|
50
|
+
path /var/log/fw1.log
|
|
51
|
+
pos_file /var/log/fluent/fw1.log.pos
|
|
52
|
+
tag fw1.log
|
|
53
|
+
<parse>
|
|
54
|
+
@type fw1_loggrabber
|
|
55
|
+
</parse>
|
|
56
|
+
</source>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
On Fluentd v0.12, write `format fw1_loggrabber` instead of the `<parse>`
|
|
60
|
+
section.
|
|
61
|
+
|
|
62
|
+
### Example
|
|
63
|
+
|
|
64
|
+
FW1-LogGrabber must write its output with `|` (0x7c) as the field separator.
|
|
65
|
+
A line such as
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
time=2016-04-18 17:11:20|action=drop|orig=192.168.0.155|src=192.168.0.90|dst=224.0.0.252|service=5355|proto=udp
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
is parsed into
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"time": "2016-04-18 17:11:20",
|
|
76
|
+
"action": "drop",
|
|
77
|
+
"orig": "192.168.0.155",
|
|
78
|
+
"src": "192.168.0.90",
|
|
79
|
+
"dst": "224.0.0.252",
|
|
80
|
+
"service": "5355",
|
|
81
|
+
"proto": "udp"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- All values are kept as strings.
|
|
86
|
+
- A `|` escaped as `\|` stays part of the value, including the backslash.
|
|
87
|
+
- The event time is the time the line is read. The `time` field is kept as a
|
|
88
|
+
record field and is not used as the event time.
|
|
89
|
+
|
|
90
|
+
## Parameters
|
|
91
|
+
|
|
92
|
+
This parser has no parameters.
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
The easiest way is the included [Dev Container](.devcontainer/devcontainer.json)
|
|
97
|
+
(VS Code / GitHub Codespaces), which sets up Ruby and runs `bundle install`:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bundle exec rake spec
|
|
101
|
+
|
|
102
|
+
# with a local coverage report (coverage/index.html)
|
|
103
|
+
COVERAGE=1 bundle exec rake spec
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Without the Dev Container, any Docker host works:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
docker run --rm -v "$PWD":/app -w /app ruby:3.4 \
|
|
110
|
+
bash -c "bundle install && bundle exec rake spec"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Bug reports and pull requests are welcome on
|
|
114
|
+
[GitHub](https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser).
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE).
|
data/Rakefile
CHANGED
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.1
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'fluent/plugin/parser_fw1_loggrabber/version'
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
6
|
spec.name = "fluent-plugin-fw1_loggrabber_parser"
|
|
8
|
-
spec.version =
|
|
7
|
+
spec.version = File.read("VERSION").strip
|
|
9
8
|
spec.authors = ["Tomoyuki Sugimura"]
|
|
10
|
-
spec.email = ["
|
|
9
|
+
spec.email = ["12116691+lunardial@users.noreply.github.com"]
|
|
11
10
|
|
|
12
|
-
spec.summary = %q{
|
|
13
|
-
spec.description = %q{
|
|
14
|
-
spec.homepage = "https://
|
|
11
|
+
spec.summary = %q{Fluentd parser plugin for Check Point FireWall-1 LEA logs from FW1-LogGrabber}
|
|
12
|
+
spec.description = %q{A Fluentd parser plugin that parses Check Point FireWall-1 LEA logs written by FW1-LogGrabber ('|'-separated key=value pairs) into records.}
|
|
13
|
+
spec.homepage = "https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser"
|
|
15
14
|
spec.license = "MIT"
|
|
15
|
+
spec.metadata = {
|
|
16
|
+
"source_code_uri" => "https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser",
|
|
17
|
+
"bug_tracker_uri" => "https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser/issues",
|
|
18
|
+
"rubygems_mfa_required" => "true",
|
|
19
|
+
}
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# spac.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
-
#else
|
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
23
|
-
#end
|
|
24
|
-
|
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
-
spec.bindir = "exe"
|
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
|
+
spec.files = `git ls-files`.split($/)
|
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
28
24
|
spec.require_paths = ["lib"]
|
|
29
|
-
|
|
30
|
-
spec.
|
|
31
|
-
|
|
32
|
-
spec.
|
|
33
|
-
|
|
25
|
+
|
|
26
|
+
spec.required_ruby_version = ">= 2.7"
|
|
27
|
+
|
|
28
|
+
spec.add_runtime_dependency "fluentd", ">= 0.12", "< 2"
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency "bundler"
|
|
31
|
+
spec.add_development_dependency "rake", ">= 13.0"
|
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
33
|
+
spec.add_development_dependency "test-unit", "~> 3.0"
|
|
34
34
|
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require 'fluent/test'
|
|
4
|
+
require 'fluent/test/driver/parser'
|
|
5
|
+
require 'fluent/plugin/parser_fw1_loggrabber'
|
|
6
|
+
|
|
7
|
+
# fluent/test loads test-unit, whose autorunner would otherwise try to parse
|
|
8
|
+
# RSpec's command line arguments and make `rake spec` exit with status 1.
|
|
9
|
+
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
|
|
10
|
+
|
|
11
|
+
RSpec.describe Fluent::TextParser::Fw1LoggrabberParser do
|
|
12
|
+
LOG = 'time=2016-04-18 17:11:20|action=drop|orig=192.168.0.155|i/f_dir=inbound|i/f_name=eth1|has_accounting=0|uuid=<00000000,00000000,00000000,00000000>|product=VPN-1 & FireWall-1|rule=4|rule_uid={6F779801F-9827-4084-A513-8C6094CCDF29}|src=192.168.0.90|s_port=54438|dst=224.0.0.252|service=5355|proto=udp|__policy_id_tag=product=VPN-1 & FireWall-1[db_tag={EFBF0C12-72BB-5542-909E-6976080402E5};mgmt=mgmt_4400;date=1460945227;policy_name=Standard]|origin_sic_name=cn=cp_mgmt,o=4400..wewbq8'
|
|
13
|
+
LOG_WITH_ESCAPED_SEPARATOR = 'time=2016-04-18 17:11:20|action=drop|orig=192.168.0.155|i/f_dir=inbound|i/f_name=eth1|has_accounting=0|uuid=<00000000,00000000,00000000,00000000>|product=VPN-1 & FireWall-1|rule=4|rule_uid={6F779801F-9827-4084-A513-8C6094CCDF29}|src=192.168.0.90|s_port=54438|dst=224.0.0.252|service=5355|proto=udp|__policy_id_tag=product=VPN-1 & FireWall-1[db_tag={EFBF0C12-72BB-5542-909E-6976080402E5};mgmt=mgmt_4400;date=1460945227;policy_name=Standard\|Irregular]|origin_sic_name=cn=cp_mgmt,o=4400..wewbq8'
|
|
14
|
+
|
|
15
|
+
EXPECTED = {
|
|
16
|
+
'__policy_id_tag' => 'product=VPN-1 & FireWall-1[db_tag={EFBF0C12-72BB-5542-909E-6976080402E5};mgmt=mgmt_4400;date=1460945227;policy_name=Standard]',
|
|
17
|
+
'action' => 'drop',
|
|
18
|
+
'dst' => '224.0.0.252',
|
|
19
|
+
'has_accounting' => '0',
|
|
20
|
+
'i/f_dir' => 'inbound',
|
|
21
|
+
'i/f_name' => 'eth1',
|
|
22
|
+
'orig' => '192.168.0.155',
|
|
23
|
+
'origin_sic_name' => 'cn=cp_mgmt,o=4400..wewbq8',
|
|
24
|
+
'product' => 'VPN-1 & FireWall-1',
|
|
25
|
+
'proto' => 'udp',
|
|
26
|
+
'rule' => '4',
|
|
27
|
+
'rule_uid' => '{6F779801F-9827-4084-A513-8C6094CCDF29}',
|
|
28
|
+
's_port' => '54438',
|
|
29
|
+
'service' => '5355',
|
|
30
|
+
'src' => '192.168.0.90',
|
|
31
|
+
'time' => '2016-04-18 17:11:20',
|
|
32
|
+
'uuid' => '<00000000,00000000,00000000,00000000>',
|
|
33
|
+
}.freeze
|
|
34
|
+
|
|
35
|
+
before :all do
|
|
36
|
+
Fluent::Test.setup
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
let(:driver) { Fluent::Test::Driver::Parser.new(described_class).configure('') }
|
|
40
|
+
|
|
41
|
+
def parse(text)
|
|
42
|
+
result = nil
|
|
43
|
+
driver.instance.parse(text) { |time, record| result = [time, record] }
|
|
44
|
+
result
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "is registered as the fw1_loggrabber parser" do
|
|
48
|
+
expect(Fluent::Plugin.new_parser('fw1_loggrabber')).to be_a(described_class)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe "#parse" do
|
|
52
|
+
it "returns a record for a LEA log line" do
|
|
53
|
+
time, record = parse(LOG)
|
|
54
|
+
expect(record).to eq(EXPECTED)
|
|
55
|
+
expect(time).to be_a(Fluent::EventTime)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "keeps an escaped separator inside a value" do
|
|
59
|
+
_, record = parse(LOG_WITH_ESCAPED_SEPARATOR)
|
|
60
|
+
expect(record).to eq(EXPECTED.merge(
|
|
61
|
+
'__policy_id_tag' => 'product=VPN-1 & FireWall-1[db_tag={EFBF0C12-72BB-5542-909E-6976080402E5};mgmt=mgmt_4400;date=1460945227;policy_name=Standard\|Irregular]'
|
|
62
|
+
))
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "returns an empty record for empty text" do
|
|
66
|
+
_, record = parse("")
|
|
67
|
+
expect(record).to eq({})
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "returns an empty record for nil" do
|
|
71
|
+
_, record = parse(nil)
|
|
72
|
+
expect(record).to eq({})
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "uses the current time as the event time" do
|
|
76
|
+
before = Fluent::EventTime.now.to_i
|
|
77
|
+
time, _ = parse(LOG)
|
|
78
|
+
expect(time.to_i).to be_between(before, Fluent::EventTime.now.to_i)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Loaded for every spec via `--require spec_helper` in .rspec.
|
|
2
|
+
# Keep this file lightweight; plugin-specific setup lives in the spec files.
|
|
3
|
+
|
|
4
|
+
# Local coverage report (no external service): COVERAGE=1 bundle exec rake spec
|
|
5
|
+
# The HTML report is written to coverage/index.html.
|
|
6
|
+
if ENV["COVERAGE"]
|
|
7
|
+
require "simplecov"
|
|
8
|
+
SimpleCov.start do
|
|
9
|
+
# SimpleCov 1.x renamed add_filter to skip; older releases (still
|
|
10
|
+
# resolved on Ruby < 3.3) only have add_filter.
|
|
11
|
+
respond_to?(:skip) ? skip("/spec/") : add_filter("/spec/")
|
|
12
|
+
enable_coverage :branch
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
config.expect_with :rspec do |expectations|
|
|
18
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
config.mock_with :rspec do |mocks|
|
|
22
|
+
mocks.verify_partial_doubles = true
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
CHANGED
|
@@ -1,111 +1,121 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-fw1_loggrabber_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomoyuki Sugimura
|
|
8
|
-
|
|
9
|
-
bindir: exe
|
|
8
|
+
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: fluentd
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0.10'
|
|
20
16
|
- - ">="
|
|
21
17
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.
|
|
23
|
-
|
|
18
|
+
version: '0.12'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '2'
|
|
22
|
+
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '0.10'
|
|
30
26
|
- - ">="
|
|
31
27
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.
|
|
28
|
+
version: '0.12'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '2'
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: bundler
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
36
35
|
requirements:
|
|
37
|
-
- - "
|
|
36
|
+
- - ">="
|
|
38
37
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
38
|
+
version: '0'
|
|
40
39
|
type: :development
|
|
41
40
|
prerelease: false
|
|
42
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
42
|
requirements:
|
|
44
|
-
- - "
|
|
43
|
+
- - ">="
|
|
45
44
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
45
|
+
version: '0'
|
|
47
46
|
- !ruby/object:Gem::Dependency
|
|
48
47
|
name: rake
|
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
|
50
49
|
requirements:
|
|
51
|
-
- - "
|
|
50
|
+
- - ">="
|
|
52
51
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
52
|
+
version: '13.0'
|
|
54
53
|
type: :development
|
|
55
54
|
prerelease: false
|
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
56
|
requirements:
|
|
58
|
-
- - "
|
|
57
|
+
- - ">="
|
|
59
58
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
59
|
+
version: '13.0'
|
|
61
60
|
- !ruby/object:Gem::Dependency
|
|
62
61
|
name: rspec
|
|
63
62
|
requirement: !ruby/object:Gem::Requirement
|
|
64
63
|
requirements:
|
|
65
|
-
- - "
|
|
64
|
+
- - "~>"
|
|
66
65
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0'
|
|
66
|
+
version: '3.0'
|
|
68
67
|
type: :development
|
|
69
68
|
prerelease: false
|
|
70
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
70
|
requirements:
|
|
72
|
-
- - "
|
|
71
|
+
- - "~>"
|
|
73
72
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '0'
|
|
73
|
+
version: '3.0'
|
|
75
74
|
- !ruby/object:Gem::Dependency
|
|
76
75
|
name: test-unit
|
|
77
76
|
requirement: !ruby/object:Gem::Requirement
|
|
78
77
|
requirements:
|
|
79
|
-
- - "
|
|
78
|
+
- - "~>"
|
|
80
79
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '0'
|
|
80
|
+
version: '3.0'
|
|
82
81
|
type: :development
|
|
83
82
|
prerelease: false
|
|
84
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
84
|
requirements:
|
|
86
|
-
- - "
|
|
85
|
+
- - "~>"
|
|
87
86
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0'
|
|
89
|
-
description:
|
|
87
|
+
version: '3.0'
|
|
88
|
+
description: A Fluentd parser plugin that parses Check Point FireWall-1 LEA logs written
|
|
89
|
+
by FW1-LogGrabber ('|'-separated key=value pairs) into records.
|
|
90
90
|
email:
|
|
91
|
-
-
|
|
91
|
+
- 12116691+lunardial@users.noreply.github.com
|
|
92
92
|
executables: []
|
|
93
93
|
extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
|
95
95
|
files:
|
|
96
|
+
- ".devcontainer/devcontainer.json"
|
|
97
|
+
- ".github/dependabot.yml"
|
|
98
|
+
- ".github/workflows/release.yml"
|
|
99
|
+
- ".github/workflows/test.yml"
|
|
96
100
|
- ".gitignore"
|
|
97
101
|
- ".rspec"
|
|
102
|
+
- CHANGELOG.md
|
|
98
103
|
- Gemfile
|
|
104
|
+
- LICENSE
|
|
99
105
|
- README.md
|
|
100
106
|
- Rakefile
|
|
107
|
+
- VERSION
|
|
101
108
|
- fluent-plugin-fw1_loggrabber_parser.gemspec
|
|
102
109
|
- lib/fluent/plugin/parser_fw1_loggrabber.rb
|
|
103
|
-
-
|
|
104
|
-
|
|
110
|
+
- spec/fluent/plugin/parser_fw1_loggrabber_spec.rb
|
|
111
|
+
- spec/spec_helper.rb
|
|
112
|
+
homepage: https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser
|
|
105
113
|
licenses:
|
|
106
114
|
- MIT
|
|
107
|
-
metadata:
|
|
108
|
-
|
|
115
|
+
metadata:
|
|
116
|
+
source_code_uri: https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser
|
|
117
|
+
bug_tracker_uri: https://github.com/lunardial/fluent-plugin-fw1_loggrabber_parser/issues
|
|
118
|
+
rubygems_mfa_required: 'true'
|
|
109
119
|
rdoc_options: []
|
|
110
120
|
require_paths:
|
|
111
121
|
- lib
|
|
@@ -113,16 +123,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
113
123
|
requirements:
|
|
114
124
|
- - ">="
|
|
115
125
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '
|
|
126
|
+
version: '2.7'
|
|
117
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
128
|
requirements:
|
|
119
129
|
- - ">="
|
|
120
130
|
- !ruby/object:Gem::Version
|
|
121
131
|
version: '0'
|
|
122
132
|
requirements: []
|
|
123
|
-
|
|
124
|
-
rubygems_version: 2.5.1
|
|
125
|
-
signing_key:
|
|
133
|
+
rubygems_version: 4.0.20
|
|
126
134
|
specification_version: 4
|
|
127
|
-
summary:
|
|
128
|
-
test_files:
|
|
135
|
+
summary: Fluentd parser plugin for Check Point FireWall-1 LEA logs from FW1-LogGrabber
|
|
136
|
+
test_files:
|
|
137
|
+
- spec/fluent/plugin/parser_fw1_loggrabber_spec.rb
|
|
138
|
+
- spec/spec_helper.rb
|