fluent-plugin-parser_cef 0.3.1 → 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 +4 -0
- data/CHANGELOG.md +58 -0
- data/Gemfile +6 -2
- data/LICENSE +1 -1
- data/README.md +170 -83
- data/Rakefile +4 -0
- data/VERSION +1 -1
- data/fluent-plugin-parser_cef.gemspec +13 -9
- data/lib/fluent/plugin/parser_cef.rb +11 -27
- data/spec/fluent/plugin/parser_cef_spec.rb +98 -35
- data/spec/sample/fluentd.conf +14 -25
- data/spec/spec_helper.rb +13 -105
- metadata +32 -45
- data/.codeclimate.yml +0 -29
- data/.coveralls.yml +0 -1
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0bc85f7ebcf43a48fba7deabb791c74db42bc70625fb6c43529b39812d14e139
|
|
4
|
+
data.tar.gz: 0df516f87fe24dd6e0df70aeb3e79d015134ddb092dab1cee216d979c891395b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acaf20adf9af9c84f5b6a5d9f6ece1d00073ea6d41e9345d17cdc455836e9b18e86f199535e7b22f257b735c69d0dfa0544c40794eb50eaa67f51a064175493d
|
|
7
|
+
data.tar.gz: 8ff3dbf2755e1a9fddcd8044b908e34cfd396580e42d7ad56ed8a878a677a1d1a8c1eb2071b3e5f8cd29882dc1a0ab04fb6c10439be6d8e0686a87fc30d66dad
|
|
@@ -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
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## 1.0.1 - 2026-12-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- The gem can be installed on Ruby 3.x and later again:
|
|
10
|
+
`required_ruby_version` is now `>= 2.7` instead of `~> 2.1`, which
|
|
11
|
+
limited 1.0.0 to Ruby 2.x (#10; also requested in #7, #9).
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- CI moved from Travis CI to GitHub Actions and runs on Ruby 2.7 and
|
|
16
|
+
3.1 - 4.0 (#10).
|
|
17
|
+
- Releases are published from GitHub Actions via RubyGems Trusted
|
|
18
|
+
Publishing (#10).
|
|
19
|
+
- Gem metadata now includes `source_code_uri`, `bug_tracker_uri` and
|
|
20
|
+
`rubygems_mfa_required`, and the summary and description were
|
|
21
|
+
rewritten (#10).
|
|
22
|
+
- README rewritten; the parameter `syslog_timestamp_format` was
|
|
23
|
+
documented under a wrong name (#10).
|
|
24
|
+
|
|
25
|
+
No change to parsing behaviour.
|
|
26
|
+
|
|
27
|
+
## 1.0.0 - 2017-12-03
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Migrated to the Fluentd v0.14 plugin API; requires Fluentd v0.14 or
|
|
32
|
+
later (#1).
|
|
33
|
+
|
|
34
|
+
## 0.3.1 - 2017-02-23
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Required Ruby version changed from 2.0 to 2.1.
|
|
39
|
+
|
|
40
|
+
## 0.3.0 - 2017-02-23
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Invalid UTF-8 characters are replaced with `?`.
|
|
45
|
+
|
|
46
|
+
## 0.2.0 - 2017-01-06
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- `log_utc_offset` option and support for timestamps with a time zone.
|
|
51
|
+
|
|
52
|
+
## 0.1.1 - 2016-12-06
|
|
53
|
+
|
|
54
|
+
- Code quality fixes.
|
|
55
|
+
|
|
56
|
+
## 0.1.0 - 2016-12-05
|
|
57
|
+
|
|
58
|
+
- Initial release.
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,83 +1,170 @@
|
|
|
1
|
-
# fluent-plugin-parser_cef
|
|
2
|
-
|
|
3
|
-
[](https://rubygems.org/gems/fluent-plugin-parser_cef)
|
|
4
|
+
[](https://github.com/lunardial/fluent-plugin-parser_cef/actions/workflows/test.yml)
|
|
5
|
+
[](https://rubygems.org/gems/fluent-plugin-parser_cef)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
A [Fluentd](https://www.fluentd.org/) parser plugin for ArcSight
|
|
9
|
+
**Common Event Format (CEF)** messages sent over syslog. It splits the syslog
|
|
10
|
+
header, the CEF header and the CEF extension (`key=value` pairs) into record
|
|
11
|
+
fields.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
| fluent-plugin-parser_cef | fluentd | Ruby |
|
|
16
|
+
|--------------------------|------------|--------|
|
|
17
|
+
| >= 1.0.1 | >= v0.14.0 | >= 2.7 |
|
|
18
|
+
| 1.0.0 | >= v0.14.0 | 2.x |
|
|
19
|
+
| < 1.0.0 | v0.12.x | - |
|
|
20
|
+
|
|
21
|
+
1.0.0 could only be installed on Ruby 2.x. Use 1.0.1 or later with
|
|
22
|
+
fluent-package v5 / v6 and other Ruby 3.x or later environments.
|
|
23
|
+
|
|
24
|
+
The 1.x series is tested against Fluentd v1 on Ruby 2.7 and 3.1 - 4.0.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# fluent-package (formerly td-agent)
|
|
30
|
+
sudo fluent-gem install fluent-plugin-parser_cef
|
|
31
|
+
|
|
32
|
+
# plain Ruby / Bundler
|
|
33
|
+
gem install fluent-plugin-parser_cef
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Official Fluentd container images and Helm charts do not include this plugin.
|
|
37
|
+
If you see `Unknown parser plugin 'cef'`, install the gem in your image, for
|
|
38
|
+
example:
|
|
39
|
+
|
|
40
|
+
```dockerfile
|
|
41
|
+
FROM fluent/fluentd:v1.17-debian-1
|
|
42
|
+
USER root
|
|
43
|
+
RUN fluent-gem install fluent-plugin-parser_cef
|
|
44
|
+
USER fluent
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
With the [fluent/helm-charts](https://github.com/fluent/helm-charts) `fluentd`
|
|
48
|
+
chart, add it to the `plugins` value instead.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Use it in a `<parse>` section:
|
|
53
|
+
|
|
54
|
+
```xml
|
|
55
|
+
<source>
|
|
56
|
+
@type tail
|
|
57
|
+
tag security.cef
|
|
58
|
+
path /var/log/cef.log
|
|
59
|
+
pos_file /var/log/fluentd/cef.log.pos
|
|
60
|
+
<parse>
|
|
61
|
+
@type cef
|
|
62
|
+
# log_utc_offset +09:00
|
|
63
|
+
# parse_strict_mode true
|
|
64
|
+
# output_raw_field false
|
|
65
|
+
</parse>
|
|
66
|
+
</source>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Parameters such as `parse_strict_mode` must be written inside `<parse>`;
|
|
70
|
+
outside it they are ignored.
|
|
71
|
+
|
|
72
|
+
### Example
|
|
73
|
+
|
|
74
|
+
Input line:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Dec 5 10:00:00 fw01 CEF:0|Example|Firewall|1.0|100|Connection blocked|5|src=192.0.2.10 dst=198.51.100.5 dpt=443 act=blocked msg=Blocked by policy web-deny
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Record (event time: `2026-12-05 10:00:00 +09:00` with `log_utc_offset +09:00`):
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"syslog_timestamp": "Dec 5 10:00:00",
|
|
85
|
+
"syslog_hostname": "fw01",
|
|
86
|
+
"syslog_tag": "",
|
|
87
|
+
"cef_version": "0",
|
|
88
|
+
"cef_device_vendor": "Example",
|
|
89
|
+
"cef_device_product": "Firewall",
|
|
90
|
+
"cef_device_version": "1.0",
|
|
91
|
+
"cef_device_event_class_id": "100",
|
|
92
|
+
"cef_name": "Connection blocked",
|
|
93
|
+
"cef_severity": "5",
|
|
94
|
+
"src": "192.0.2.10",
|
|
95
|
+
"dst": "198.51.100.5",
|
|
96
|
+
"dpt": "443",
|
|
97
|
+
"act": "blocked",
|
|
98
|
+
"msg": "Blocked by policy web-deny"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The syslog timestamp becomes the event time. Lines that do not match the
|
|
103
|
+
expected format are emitted as `{"raw": "<the original line>"}`.
|
|
104
|
+
|
|
105
|
+
### Supported input format
|
|
106
|
+
|
|
107
|
+
Each line must start with a traditional (RFC 3164 style) syslog header —
|
|
108
|
+
timestamp, hostname and an optional tag — followed by the CEF message:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
<timestamp> <hostname> [<tag>] CEF:0|Vendor|Product|Version|SignatureID|Name|Severity|Extension
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
A leading `<PRI>` value, RFC 5424 headers and CEF messages without a syslog
|
|
115
|
+
header are not supported yet and are emitted as `raw`.
|
|
116
|
+
|
|
117
|
+
## Parameters
|
|
118
|
+
|
|
119
|
+
| Name | Type | Default | Description |
|
|
120
|
+
|---------------------------|---------|-----------------------------------------------|-------------|
|
|
121
|
+
| `log_format` | string | `syslog` | Input format. Only `syslog` is supported. |
|
|
122
|
+
| `log_utc_offset` | string | `nil` | UTC offset (e.g. `+09:00`) used when the timestamp has no time zone. When unset or invalid, the system time zone is used. Ignored for timestamps that include a time zone. |
|
|
123
|
+
| `syslog_timestamp_format` | string | `\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}` | Regular expression that matches the syslog timestamp. The default matches `Dec 5 10:00:00`. |
|
|
124
|
+
| `cef_version` | integer | `0` | CEF version in the `CEF:<version>` header. |
|
|
125
|
+
| `parse_strict_mode` | bool | `true` | Only treat known CEF keys as keys. See below. |
|
|
126
|
+
| `cef_keyfilename` | string | `config/cef_version_0_keys.yaml` | YAML file with the known CEF keys used in strict mode. Relative paths are resolved from the plugin directory. |
|
|
127
|
+
| `output_raw_field` | bool | `false` | Also add the original line as `raw` when parsing succeeds. |
|
|
128
|
+
|
|
129
|
+
### Strict mode
|
|
130
|
+
|
|
131
|
+
CEF extension values may contain spaces and `=`. With `parse_strict_mode true`,
|
|
132
|
+
only the keys listed in `cef_keyfilename` start a new field, so for
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
cs1=test cs2=foo hoge=fuga cs3=bar
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`cs2` becomes `foo hoge=fuga`. With `parse_strict_mode false`, every `key=`
|
|
139
|
+
starts a new field, so `cs2` becomes `foo` and an extra `hoge` field with
|
|
140
|
+
`fuga` is added.
|
|
141
|
+
|
|
142
|
+
In strict mode, vendor-specific keys that are not in the key file are appended
|
|
143
|
+
to the previous value. Use your own key file, or `parse_strict_mode false`, if
|
|
144
|
+
your devices send such keys.
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
The easiest way is the included [Dev Container](.devcontainer/devcontainer.json)
|
|
149
|
+
(VS Code / GitHub Codespaces), which sets up Ruby and runs `bundle install`:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
bundle exec rake spec
|
|
153
|
+
|
|
154
|
+
# with a local coverage report (coverage/index.html)
|
|
155
|
+
COVERAGE=1 bundle exec rake spec
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Without the Dev Container, any Docker host works:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
docker run --rm -v "$PWD":/app -w /app ruby:3.4 \
|
|
162
|
+
bash -c "bundle install && bundle exec rake spec"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Bug reports and pull requests are welcome on
|
|
166
|
+
[GitHub](https://github.com/lunardial/fluent-plugin-parser_cef).
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE).
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.1
|
|
@@ -6,24 +6,28 @@ Gem::Specification.new do |spec|
|
|
|
6
6
|
spec.name = "fluent-plugin-parser_cef"
|
|
7
7
|
spec.version = File.read("VERSION").strip
|
|
8
8
|
spec.authors = ["Tomoyuki Sugimura"]
|
|
9
|
-
spec.email = ["
|
|
10
|
-
spec.
|
|
11
|
-
spec.
|
|
9
|
+
spec.email = ["12116691+lunardial@users.noreply.github.com"]
|
|
10
|
+
spec.summary = %q{Fluentd parser plugin for Common Event Format (CEF) messages}
|
|
11
|
+
spec.description = %q{A Fluentd parser plugin that parses syslog messages carrying ArcSight Common Event Format (CEF) into records, splitting the CEF header and extension fields.}
|
|
12
12
|
spec.homepage = "https://github.com/lunardial/fluent-plugin-parser_cef"
|
|
13
13
|
spec.license = "MIT"
|
|
14
|
+
spec.metadata = {
|
|
15
|
+
"source_code_uri" => "https://github.com/lunardial/fluent-plugin-parser_cef",
|
|
16
|
+
"bug_tracker_uri" => "https://github.com/lunardial/fluent-plugin-parser_cef/issues",
|
|
17
|
+
"rubygems_mfa_required" => "true",
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
spec.files = `git ls-files`.split($/)
|
|
16
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
23
|
spec.require_paths = ["lib"]
|
|
19
24
|
|
|
20
|
-
spec.required_ruby_version = "
|
|
25
|
+
spec.required_ruby_version = ">= 2.7"
|
|
21
26
|
|
|
22
|
-
spec.add_runtime_dependency "fluentd", ">= 0.
|
|
27
|
+
spec.add_runtime_dependency "fluentd", ">= 0.14.0", "< 2"
|
|
23
28
|
|
|
24
|
-
spec.add_development_dependency "bundler"
|
|
25
|
-
spec.add_development_dependency "rake"
|
|
29
|
+
spec.add_development_dependency "bundler"
|
|
30
|
+
spec.add_development_dependency "rake", ">= 13.0"
|
|
26
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
27
|
-
spec.add_development_dependency "
|
|
28
|
-
spec.add_development_dependency "test-unit"
|
|
32
|
+
spec.add_development_dependency "test-unit", "~> 3.0"
|
|
29
33
|
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# -*- coding: utf-8
|
|
2
2
|
|
|
3
3
|
require 'fluent/log'
|
|
4
|
-
require 'fluent/parser'
|
|
4
|
+
require 'fluent/plugin/parser'
|
|
5
5
|
require 'time'
|
|
6
6
|
require 'yaml'
|
|
7
7
|
|
|
8
8
|
module Fluent
|
|
9
|
-
|
|
9
|
+
module Plugin
|
|
10
10
|
class CommonEventFormatParser < Parser
|
|
11
|
-
Plugin.register_parser("cef", self)
|
|
11
|
+
Fluent::Plugin.register_parser("cef", self)
|
|
12
12
|
config_param :log_format, :string, :default => "syslog"
|
|
13
13
|
config_param :log_utc_offset, :string, :default => nil
|
|
14
14
|
config_param :syslog_timestamp_format, :string, :default => '\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}'
|
|
@@ -44,24 +44,16 @@ module Fluent
|
|
|
44
44
|
|
|
45
45
|
def parse(text)
|
|
46
46
|
if text.nil? || text.empty?
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
else
|
|
51
|
-
return nil, nil
|
|
52
|
-
end
|
|
47
|
+
yield nil, nil
|
|
48
|
+
return
|
|
53
49
|
end
|
|
54
50
|
text.force_encoding("utf-8")
|
|
55
51
|
replaced_text = text.scrub('?')
|
|
56
52
|
record = {}
|
|
57
53
|
record_overview = @valid_format_regexp.match(replaced_text)
|
|
58
54
|
if record_overview.nil?
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
else
|
|
63
|
-
return Engine.now, { "raw" => replaced_text }
|
|
64
|
-
end
|
|
55
|
+
yield Engine.now, { "raw" => replaced_text }
|
|
56
|
+
return
|
|
65
57
|
end
|
|
66
58
|
time = get_unixtime_with_utc_offset(record_overview["syslog_timestamp"], @utc_offset)
|
|
67
59
|
begin
|
|
@@ -69,24 +61,16 @@ module Fluent
|
|
|
69
61
|
text_cef_extension = record_overview["cef_extension"]
|
|
70
62
|
record.delete("cef_extension")
|
|
71
63
|
rescue
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
75
|
-
else
|
|
76
|
-
return Engine.now, { "raw" => replaced_text }
|
|
77
|
-
end
|
|
64
|
+
yield Engine.now, { "raw" => replaced_text }
|
|
65
|
+
return
|
|
78
66
|
end
|
|
79
67
|
unless text_cef_extension.nil?
|
|
80
68
|
record_cef_extension = parse_cef_extension(text_cef_extension)
|
|
81
69
|
record.merge!(record_cef_extension)
|
|
82
70
|
end
|
|
83
71
|
record["raw"] = replaced_text if @output_raw_field
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
else
|
|
88
|
-
return time, record
|
|
89
|
-
end
|
|
72
|
+
yield time, record
|
|
73
|
+
return
|
|
90
74
|
end
|
|
91
75
|
|
|
92
76
|
private
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require 'fluent/plugin/parser_cef'
|
|
4
4
|
require 'fluent/test'
|
|
5
|
+
# fluent/test loads test-unit, whose at_exit autorunner would otherwise try
|
|
6
|
+
# to parse RSpec's command-line options (e.g. --pattern) and fail the run.
|
|
7
|
+
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
|
|
8
|
+
require 'fluent/test/driver/parser'
|
|
5
9
|
|
|
6
|
-
RSpec.describe Fluent::
|
|
10
|
+
RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
7
11
|
|
|
8
12
|
DEFAULT_CONFIGURE = %[
|
|
9
13
|
log_format syslog
|
|
@@ -13,8 +17,8 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
13
17
|
cef_keyfilename 'config/cef_version_0_keys.yaml'
|
|
14
18
|
output_raw_field false
|
|
15
19
|
]
|
|
16
|
-
def create_driver(conf=DEFAULT_CONFIGURE
|
|
17
|
-
Fluent::Test::
|
|
20
|
+
def create_driver(conf=DEFAULT_CONFIGURE)
|
|
21
|
+
Fluent::Test::Driver::Parser.new(Fluent::Plugin::CommonEventFormatParser).configure(conf)
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
before :all do
|
|
@@ -30,47 +34,71 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
30
34
|
context "text == nil" do
|
|
31
35
|
let (:text) { nil }
|
|
32
36
|
subject do
|
|
33
|
-
|
|
37
|
+
parsed = nil
|
|
38
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
39
|
+
parsed = [time, record]
|
|
40
|
+
end
|
|
41
|
+
parsed
|
|
34
42
|
end
|
|
35
43
|
it { is_expected.to eq [nil, nil] }
|
|
36
44
|
end
|
|
37
45
|
context "text is empty string" do
|
|
38
46
|
let (:text) { "" }
|
|
39
47
|
subject do
|
|
40
|
-
|
|
48
|
+
parsed = nil
|
|
49
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
50
|
+
parsed = [time, record]
|
|
51
|
+
end
|
|
52
|
+
parsed
|
|
41
53
|
end
|
|
42
54
|
it { is_expected.to eq [nil, nil] }
|
|
43
55
|
end
|
|
44
56
|
context "text is not syslog format nor CEF" do
|
|
45
57
|
let (:text) { "December 12 10:00:00 hostname tag message" }
|
|
46
58
|
subject do
|
|
47
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
48
|
-
|
|
59
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
60
|
+
parsed = nil
|
|
61
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
62
|
+
parsed = [time, record]
|
|
63
|
+
end
|
|
64
|
+
parsed
|
|
49
65
|
end
|
|
50
|
-
it { is_expected.to contain_exactly(be_an(
|
|
66
|
+
it { is_expected.to contain_exactly(be_an(Fluent::EventTime), { "raw" => "December 12 10:00:00 hostname tag message" }) }
|
|
51
67
|
end
|
|
52
68
|
context "text is not in syslog format but is CEF" do
|
|
53
69
|
let (:text) { "December 12 10:00:00 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }
|
|
54
70
|
subject do
|
|
55
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
56
|
-
|
|
71
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
72
|
+
parsed = nil
|
|
73
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
74
|
+
parsed = [time, record]
|
|
75
|
+
end
|
|
76
|
+
parsed
|
|
57
77
|
end
|
|
58
|
-
it { is_expected.to contain_exactly(be_an(
|
|
78
|
+
it { is_expected.to contain_exactly(be_an(Fluent::EventTime), { "raw" => "December 12 10:00:00 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }) }
|
|
59
79
|
end
|
|
60
80
|
context "text is syslog format but not CEF" do
|
|
61
81
|
let (:text) { "Dec 12 10:11:12 hostname tag message" }
|
|
62
82
|
subject do
|
|
63
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
64
|
-
|
|
83
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
84
|
+
parsed = nil
|
|
85
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
86
|
+
parsed = [time, record]
|
|
87
|
+
end
|
|
88
|
+
parsed
|
|
65
89
|
end
|
|
66
|
-
it { is_expected.to contain_exactly(be_an(
|
|
90
|
+
it { is_expected.to contain_exactly(be_an(Fluent::EventTime), { "raw" => "Dec 12 10:11:12 hostname tag message" }) }
|
|
67
91
|
end
|
|
68
92
|
context "text is syslog format and CEF (CEF Extension field is empty)" do
|
|
69
93
|
let (:text) { "Dec 2 03:17:06 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|" }
|
|
70
94
|
subject do
|
|
71
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
95
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
72
96
|
@timestamp = Time.parse("Dec 2 03:17:06").to_i
|
|
73
|
-
|
|
97
|
+
parsed = nil
|
|
98
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
99
|
+
parsed = [time, record]
|
|
100
|
+
end
|
|
101
|
+
parsed
|
|
74
102
|
end
|
|
75
103
|
it { is_expected.to eq [
|
|
76
104
|
@timestamp, {
|
|
@@ -88,9 +116,13 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
88
116
|
context "text is syslog format and CEF (there is only one valid key in the CEF Extension field), Strict mode on" do
|
|
89
117
|
let (:text) { "Dec 2 03:17:06 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }
|
|
90
118
|
subject do
|
|
91
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
119
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
92
120
|
@timestamp = Time.parse("Dec 2 03:17:06").to_i
|
|
93
|
-
|
|
121
|
+
parsed = nil
|
|
122
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
123
|
+
parsed = [time, record]
|
|
124
|
+
end
|
|
125
|
+
parsed
|
|
94
126
|
end
|
|
95
127
|
it { is_expected.to eq [
|
|
96
128
|
@timestamp, {
|
|
@@ -112,10 +144,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
112
144
|
]}
|
|
113
145
|
let (:text) { "Dec 2 03:17:06 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|foo=bar" }
|
|
114
146
|
subject do
|
|
115
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
147
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
116
148
|
@timestamp = Time.parse("Dec 2 03:17:06").to_i
|
|
117
149
|
@test_driver = create_driver(config)
|
|
118
|
-
|
|
150
|
+
parsed = nil
|
|
151
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
152
|
+
parsed = [time, record]
|
|
153
|
+
end
|
|
154
|
+
parsed
|
|
119
155
|
end
|
|
120
156
|
it { is_expected.to eq [
|
|
121
157
|
@timestamp, {
|
|
@@ -137,10 +173,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
137
173
|
]}
|
|
138
174
|
let (:text) { "2014-06-07T18:55:09.019283+09:00 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|foo=bar" }
|
|
139
175
|
subject do
|
|
140
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
176
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
141
177
|
@timestamp = Time.parse("2014-06-07T18:55:09.019283+09:00").to_i
|
|
142
178
|
@test_driver = create_driver(config)
|
|
143
|
-
|
|
179
|
+
parsed = nil
|
|
180
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
181
|
+
parsed = [time, record]
|
|
182
|
+
end
|
|
183
|
+
parsed
|
|
144
184
|
end
|
|
145
185
|
it { is_expected.to eq [
|
|
146
186
|
@timestamp, {
|
|
@@ -161,10 +201,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
161
201
|
]}
|
|
162
202
|
let (:text) { "2014-06-07T18:55:09.019283+03:00 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|foo=bar" }
|
|
163
203
|
subject do
|
|
164
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
204
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
165
205
|
@timestamp = Time.parse("2014-06-07T18:55:09.019283+03:00").to_i
|
|
166
206
|
@test_driver = create_driver(config)
|
|
167
|
-
|
|
207
|
+
parsed = nil
|
|
208
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
209
|
+
parsed = [time, record]
|
|
210
|
+
end
|
|
211
|
+
parsed
|
|
168
212
|
end
|
|
169
213
|
it { is_expected.to eq [
|
|
170
214
|
@timestamp, {
|
|
@@ -185,10 +229,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
185
229
|
]}
|
|
186
230
|
let (:text) { "2014-06-07T18:55:09.019283Z hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|foo=bar" }
|
|
187
231
|
subject do
|
|
188
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
232
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
189
233
|
@timestamp = Time.parse("2014-06-07T18:55:09.019283Z").to_i
|
|
190
234
|
@test_driver = create_driver(config)
|
|
191
|
-
|
|
235
|
+
parsed = nil
|
|
236
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
237
|
+
parsed = [time, record]
|
|
238
|
+
end
|
|
239
|
+
parsed
|
|
192
240
|
end
|
|
193
241
|
it { is_expected.to eq [
|
|
194
242
|
@timestamp, {
|
|
@@ -209,10 +257,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
209
257
|
]}
|
|
210
258
|
let (:text) { "Dec 2 03:17:06 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }
|
|
211
259
|
subject do
|
|
212
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
260
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
213
261
|
@timestamp = Time.parse("Dec 2 03:17:06 +04:00").to_i
|
|
214
262
|
@test_driver = create_driver(config)
|
|
215
|
-
|
|
263
|
+
parsed = nil
|
|
264
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
265
|
+
parsed = [time, record]
|
|
266
|
+
end
|
|
267
|
+
parsed
|
|
216
268
|
end
|
|
217
269
|
it { is_expected.to eq [
|
|
218
270
|
@timestamp, {
|
|
@@ -235,10 +287,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
235
287
|
]}
|
|
236
288
|
let (:text) { "2013-07-24T12:34:56.923984+03:30 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }
|
|
237
289
|
subject do
|
|
238
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
290
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
239
291
|
@timestamp = Time.parse("2013-07-24T12:34:56.923984+03:30").to_i
|
|
240
292
|
@test_driver = create_driver(config)
|
|
241
|
-
|
|
293
|
+
parsed = nil
|
|
294
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
295
|
+
parsed = [time, record]
|
|
296
|
+
end
|
|
297
|
+
parsed
|
|
242
298
|
end
|
|
243
299
|
it { is_expected.to eq [
|
|
244
300
|
@timestamp, {
|
|
@@ -260,14 +316,18 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
260
316
|
]}
|
|
261
317
|
let (:text) { "Dec 2 03:17:06 hostname tag ***CEF:0|Vendor|Product|Version|ID|Name|Severity|cs1=test" }
|
|
262
318
|
subject do
|
|
263
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
319
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
264
320
|
@timestamp = Time.parse("Dec 2 03:17:06 -07:00").to_i
|
|
265
321
|
@test_driver = create_driver(config)
|
|
266
322
|
text.setbyte(29, 0xef)
|
|
267
323
|
text.setbyte(30, 0xbb)
|
|
268
324
|
text.setbyte(31, 0xbf)
|
|
269
325
|
text.force_encoding("ascii-8bit")
|
|
270
|
-
|
|
326
|
+
parsed = nil
|
|
327
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
328
|
+
parsed = [time, record]
|
|
329
|
+
end
|
|
330
|
+
parsed
|
|
271
331
|
end
|
|
272
332
|
it { is_expected.to eq [
|
|
273
333
|
@timestamp, {
|
|
@@ -289,11 +349,14 @@ RSpec.describe Fluent::TextParser::CommonEventFormatParser do
|
|
|
289
349
|
]}
|
|
290
350
|
let (:text) { "Feb 19 00:35:11 hogehuga CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.168.1.1 spt=60000 dst=172.16.100.100 dpt=80 msg=\xe3\x2e\x2e\x2e" }
|
|
291
351
|
subject do
|
|
292
|
-
allow(Fluent::Engine).to receive(:now).and_return(
|
|
352
|
+
allow(Fluent::Engine).to receive(:now).and_return(Fluent::EventTime.now)
|
|
293
353
|
@timestamp = Time.parse("Feb 19 00:35:11 +09:00").to_i
|
|
294
354
|
@test_driver = create_driver(config)
|
|
295
|
-
|
|
296
|
-
@test_driver.parse(text)
|
|
355
|
+
parsed = nil
|
|
356
|
+
@test_driver.instance.parse(text) do |time, record|
|
|
357
|
+
parsed = [time, record]
|
|
358
|
+
end
|
|
359
|
+
parsed
|
|
297
360
|
end
|
|
298
361
|
it { is_expected.to eq [
|
|
299
362
|
@timestamp, {
|
data/spec/sample/fluentd.conf
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
<source>
|
|
2
|
-
@type
|
|
3
|
-
tag
|
|
2
|
+
@type tail
|
|
3
|
+
tag develop.cef
|
|
4
4
|
path /tmp/fluentd/test.log
|
|
5
5
|
pos_file /tmp/fluentd/test.pos
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
<parse>
|
|
7
|
+
@type cef
|
|
8
|
+
#log_format syslog
|
|
9
|
+
#log_utc_offset +09:00
|
|
10
|
+
#syslog_timestamp_format '\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}'
|
|
11
|
+
#cef_version 0
|
|
12
|
+
#parse_strict_mode true
|
|
13
|
+
#cef_keyfilename 'config/cef_version_0_keys.yaml'
|
|
14
|
+
#output_raw_field false
|
|
15
|
+
</parse>
|
|
14
16
|
</source>
|
|
15
17
|
|
|
16
|
-
<match
|
|
17
|
-
@type
|
|
18
|
+
<match develop.cef>
|
|
19
|
+
@type stdout
|
|
18
20
|
</match>
|
|
19
|
-
|
|
20
|
-
#<match cevelop.cef>
|
|
21
|
-
# @type elasticsearch
|
|
22
|
-
# host elasticsearch
|
|
23
|
-
# port 9200
|
|
24
|
-
# logstash_format true
|
|
25
|
-
# logstash_dateformat %Y.%m.%d
|
|
26
|
-
# utc_index true
|
|
27
|
-
# include_tag_key false
|
|
28
|
-
# logstash_prefix develop
|
|
29
|
-
# type_name develop
|
|
30
|
-
# flush_interval 1s
|
|
31
|
-
#</match>
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,116 +1,24 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
16
|
-
# users commonly want.
|
|
17
|
-
#
|
|
18
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
19
|
-
|
|
20
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
|
|
21
|
-
$LOAD_PATH.unshift(File.expand_path('../spec', __FILE__))
|
|
22
|
-
|
|
23
|
-
require 'simplecov'
|
|
24
|
-
require 'coveralls'
|
|
25
|
-
Coveralls.wear!
|
|
26
|
-
|
|
27
|
-
SimpleCov.start do
|
|
28
|
-
add_filter "/spec/"
|
|
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
|
|
29
14
|
end
|
|
30
15
|
|
|
31
16
|
RSpec.configure do |config|
|
|
32
|
-
# rspec-expectations config goes here. You can use an alternate
|
|
33
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
34
|
-
# assertions if you prefer.
|
|
35
17
|
config.expect_with :rspec do |expectations|
|
|
36
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
37
|
-
# and `failure_message` of custom matchers include text for helper methods
|
|
38
|
-
# defined using `chain`, e.g.:
|
|
39
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
|
40
|
-
# # => "be bigger than 2 and smaller than 4"
|
|
41
|
-
# ...rather than:
|
|
42
|
-
# # => "be bigger than 2"
|
|
43
18
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
44
19
|
end
|
|
45
20
|
|
|
46
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
|
47
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
48
21
|
config.mock_with :rspec do |mocks|
|
|
49
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
|
50
|
-
# a real object. This is generally recommended, and will default to
|
|
51
|
-
# `true` in RSpec 4.
|
|
52
22
|
mocks.verify_partial_doubles = true
|
|
53
23
|
end
|
|
54
|
-
|
|
55
|
-
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
56
|
-
# have no way to turn it off -- the option exists only for backwards
|
|
57
|
-
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
58
|
-
# inherited by the metadata hash of host groups and examples, rather than
|
|
59
|
-
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
60
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
61
|
-
|
|
62
|
-
# The settings below are suggested to provide a good initial experience
|
|
63
|
-
# with RSpec, but feel free to customize to your heart's content.
|
|
64
|
-
=begin
|
|
65
|
-
# This allows you to limit a spec run to individual examples or groups
|
|
66
|
-
# you care about by tagging them with `:focus` metadata. When nothing
|
|
67
|
-
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
68
|
-
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
69
|
-
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
70
|
-
config.filter_run_when_matching :focus
|
|
71
|
-
|
|
72
|
-
# Allows RSpec to persist some state between runs in order to support
|
|
73
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
74
|
-
# you configure your source control system to ignore this file.
|
|
75
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
76
|
-
|
|
77
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
|
78
|
-
# recommended. For more details, see:
|
|
79
|
-
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
|
80
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
81
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
82
|
-
config.disable_monkey_patching!
|
|
83
|
-
|
|
84
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
|
85
|
-
# be too noisy due to issues in dependencies.
|
|
86
|
-
config.warnings = true
|
|
87
|
-
|
|
88
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
|
89
|
-
# file, and it's useful to allow more verbose output when running an
|
|
90
|
-
# individual spec file.
|
|
91
|
-
if config.files_to_run.one?
|
|
92
|
-
# Use the documentation formatter for detailed output,
|
|
93
|
-
# unless a formatter has already been configured
|
|
94
|
-
# (e.g. via a command-line flag).
|
|
95
|
-
config.default_formatter = 'doc'
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Print the 10 slowest examples and example groups at the
|
|
99
|
-
# end of the spec run, to help surface which specs are running
|
|
100
|
-
# particularly slow.
|
|
101
|
-
config.profile_examples = 10
|
|
102
|
-
|
|
103
|
-
# Run specs in random order to surface order dependencies. If you find an
|
|
104
|
-
# order dependency and want to debug it, you can fix the order by providing
|
|
105
|
-
# the seed, which is printed after each run.
|
|
106
|
-
# --seed 1234
|
|
107
|
-
#config.order = :random
|
|
108
|
-
|
|
109
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
|
110
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
111
|
-
# test failures related to randomization by passing the same `--seed` value
|
|
112
|
-
# as the one that triggered the failure.
|
|
113
|
-
Kernel.srand config.seed
|
|
114
|
-
=end
|
|
115
24
|
end
|
|
116
|
-
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-parser_cef
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomoyuki Sugimura
|
|
8
|
-
autorequire:
|
|
9
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
|
|
@@ -16,48 +15,48 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: 0.14.0
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
21
|
+
version: '2'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
28
|
+
version: 0.14.0
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
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: '0'
|
|
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: '0'
|
|
59
|
+
version: '13.0'
|
|
61
60
|
- !ruby/object:Gem::Dependency
|
|
62
61
|
name: rspec
|
|
63
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,47 +71,36 @@ dependencies:
|
|
|
72
71
|
- - "~>"
|
|
73
72
|
- !ruby/object:Gem::Version
|
|
74
73
|
version: '3.0'
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: rspec-core
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - ">="
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '0'
|
|
82
|
-
type: :development
|
|
83
|
-
prerelease: false
|
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - ">="
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0'
|
|
89
74
|
- !ruby/object:Gem::Dependency
|
|
90
75
|
name: test-unit
|
|
91
76
|
requirement: !ruby/object:Gem::Requirement
|
|
92
77
|
requirements:
|
|
93
|
-
- - "
|
|
78
|
+
- - "~>"
|
|
94
79
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '0'
|
|
80
|
+
version: '3.0'
|
|
96
81
|
type: :development
|
|
97
82
|
prerelease: false
|
|
98
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
84
|
requirements:
|
|
100
|
-
- - "
|
|
85
|
+
- - "~>"
|
|
101
86
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0'
|
|
103
|
-
description:
|
|
87
|
+
version: '3.0'
|
|
88
|
+
description: A Fluentd parser plugin that parses syslog messages carrying ArcSight
|
|
89
|
+
Common Event Format (CEF) into records, splitting the CEF header and extension fields.
|
|
104
90
|
email:
|
|
105
|
-
-
|
|
91
|
+
- 12116691+lunardial@users.noreply.github.com
|
|
106
92
|
executables: []
|
|
107
93
|
extensions: []
|
|
108
94
|
extra_rdoc_files: []
|
|
109
95
|
files:
|
|
110
|
-
- ".
|
|
111
|
-
- ".
|
|
96
|
+
- ".devcontainer/devcontainer.json"
|
|
97
|
+
- ".github/dependabot.yml"
|
|
98
|
+
- ".github/workflows/release.yml"
|
|
99
|
+
- ".github/workflows/test.yml"
|
|
112
100
|
- ".gitignore"
|
|
113
101
|
- ".rspec"
|
|
114
102
|
- ".rubocop.yml"
|
|
115
|
-
-
|
|
103
|
+
- CHANGELOG.md
|
|
116
104
|
- Gemfile
|
|
117
105
|
- LICENSE
|
|
118
106
|
- README.md
|
|
@@ -127,28 +115,27 @@ files:
|
|
|
127
115
|
homepage: https://github.com/lunardial/fluent-plugin-parser_cef
|
|
128
116
|
licenses:
|
|
129
117
|
- MIT
|
|
130
|
-
metadata:
|
|
131
|
-
|
|
118
|
+
metadata:
|
|
119
|
+
source_code_uri: https://github.com/lunardial/fluent-plugin-parser_cef
|
|
120
|
+
bug_tracker_uri: https://github.com/lunardial/fluent-plugin-parser_cef/issues
|
|
121
|
+
rubygems_mfa_required: 'true'
|
|
132
122
|
rdoc_options: []
|
|
133
123
|
require_paths:
|
|
134
124
|
- lib
|
|
135
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
126
|
requirements:
|
|
137
|
-
- - "
|
|
127
|
+
- - ">="
|
|
138
128
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: '2.
|
|
129
|
+
version: '2.7'
|
|
140
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
131
|
requirements:
|
|
142
132
|
- - ">="
|
|
143
133
|
- !ruby/object:Gem::Version
|
|
144
134
|
version: '0'
|
|
145
135
|
requirements: []
|
|
146
|
-
|
|
147
|
-
rubygems_version: 2.5.2
|
|
148
|
-
signing_key:
|
|
136
|
+
rubygems_version: 4.0.20
|
|
149
137
|
specification_version: 4
|
|
150
|
-
summary:
|
|
151
|
-
permitted
|
|
138
|
+
summary: Fluentd parser plugin for Common Event Format (CEF) messages
|
|
152
139
|
test_files:
|
|
153
140
|
- spec/fluent/plugin/parser_cef_spec.rb
|
|
154
141
|
- spec/sample/fluentd.conf
|
data/.codeclimate.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
engines:
|
|
2
|
-
duplication:
|
|
3
|
-
enabled: true
|
|
4
|
-
config:
|
|
5
|
-
languages:
|
|
6
|
-
- ruby
|
|
7
|
-
- javascript
|
|
8
|
-
- python
|
|
9
|
-
- php
|
|
10
|
-
fixme:
|
|
11
|
-
enabled: true
|
|
12
|
-
rubocop:
|
|
13
|
-
enabled: true
|
|
14
|
-
checks:
|
|
15
|
-
Rubocop/Metrics/MethodLength:
|
|
16
|
-
enabled: false
|
|
17
|
-
Rubocop/Metrics/CyclomaticComplexity:
|
|
18
|
-
enabled: false
|
|
19
|
-
ratings:
|
|
20
|
-
paths:
|
|
21
|
-
- "**.inc"
|
|
22
|
-
- "**.js"
|
|
23
|
-
- "**.jsx"
|
|
24
|
-
- "**.module"
|
|
25
|
-
- "**.php"
|
|
26
|
-
- "**.py"
|
|
27
|
-
- "**.rb"
|
|
28
|
-
exclude_paths:
|
|
29
|
-
- spec/
|
data/.coveralls.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
service_name: travis-ci
|