fluent-plugin-parser_cef 1.0.0 → 1.1.0
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 +76 -0
- data/Gemfile +6 -2
- data/LICENSE +1 -1
- data/README.md +177 -96
- data/Rakefile +4 -0
- data/VERSION +1 -1
- data/fluent-plugin-parser_cef.gemspec +12 -8
- data/lib/fluent/plugin/config/cef_version_0_keys.yaml +50 -0
- data/lib/fluent/plugin/parser_cef.rb +49 -17
- data/spec/fluent/plugin/parser_cef_spec.rb +166 -3
- data/spec/sample/fluentd.conf +14 -25
- data/spec/spec_helper.rb +13 -105
- metadata +28 -41
- 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: 0b377ec06f9633e8cec0a789315bd8ad5a659773344d73607897c6b8adc192e6
|
|
4
|
+
data.tar.gz: 52ebe7cebfd303741fd0992dcdaf3df612ce98441ead5b2f9b9eb65ae8182b84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f71acec6579ffae1975da597e62156cd8e522d9cb26316288b9d9b6b33e2f32741edd1498af5baa737b67edfd376541ca077673d8f37c43edf2cc0189009dbf7
|
|
7
|
+
data.tar.gz: 72ae69b82cf81ade1dfc54d6b5175cd133d0320b8e3cf58957be47c533fa9190545efb49d07f4af2d2a7746b6cb705ffd113e0fe8f0e1d445cdf73721c280ff5
|
|
@@ -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,76 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## 1.1.0 - 2026-12-05
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Lines with a syslog `<PRI>` value (added as `syslog_pri`), an RFC 5424
|
|
10
|
+
header (adds `syslog_version`, `syslog_procid`, `syslog_msgid` and
|
|
11
|
+
`syslog_structured_data`; APP-NAME goes to `syslog_tag`) or no syslog
|
|
12
|
+
header (starting with `CEF:`) are now parsed instead of being emitted
|
|
13
|
+
as `raw` (#3, #8, #12; based on #4).
|
|
14
|
+
- Palo Alto Networks PAN-OS keys in the default key file (#6, #12).
|
|
15
|
+
- `cef_additional_keys` option to add known keys for strict mode (#12).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Strict mode: when the first extension key was not a known key, the
|
|
20
|
+
whole extension was dropped. Such a key now becomes a field (#12).
|
|
21
|
+
- Timestamps ending in `Z` are read as UTC (#12).
|
|
22
|
+
|
|
23
|
+
## 1.0.1 - 2026-12-05
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- The gem can be installed on Ruby 3.x and later again:
|
|
28
|
+
`required_ruby_version` is now `>= 2.7` instead of `~> 2.1`, which
|
|
29
|
+
limited 1.0.0 to Ruby 2.x (#10; also requested in #7, #9).
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- CI moved from Travis CI to GitHub Actions and runs on Ruby 2.7 and
|
|
34
|
+
3.1 - 4.0 (#10).
|
|
35
|
+
- Releases are published from GitHub Actions via RubyGems Trusted
|
|
36
|
+
Publishing (#10).
|
|
37
|
+
- Gem metadata now includes `source_code_uri`, `bug_tracker_uri` and
|
|
38
|
+
`rubygems_mfa_required`, and the summary and description were
|
|
39
|
+
rewritten (#10).
|
|
40
|
+
- README rewritten; the parameter `syslog_timestamp_format` was
|
|
41
|
+
documented under a wrong name (#10).
|
|
42
|
+
|
|
43
|
+
No change to parsing behaviour.
|
|
44
|
+
|
|
45
|
+
## 1.0.0 - 2017-12-03
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Migrated to the Fluentd v0.14 plugin API; requires Fluentd v0.14 or
|
|
50
|
+
later (#1).
|
|
51
|
+
|
|
52
|
+
## 0.3.1 - 2017-02-23
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Required Ruby version changed from 2.0 to 2.1.
|
|
57
|
+
|
|
58
|
+
## 0.3.0 - 2017-02-23
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- Invalid UTF-8 characters are replaced with `?`.
|
|
63
|
+
|
|
64
|
+
## 0.2.0 - 2017-01-06
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- `log_utc_offset` option and support for timestamps with a time zone.
|
|
69
|
+
|
|
70
|
+
## 0.1.1 - 2016-12-06
|
|
71
|
+
|
|
72
|
+
- Code quality fixes.
|
|
73
|
+
|
|
74
|
+
## 0.1.0 - 2016-12-05
|
|
75
|
+
|
|
76
|
+
- Initial release.
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,96 +1,177 @@
|
|
|
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
|
+
Lines that do not match any supported format are emitted as
|
|
103
|
+
`{"raw": "<the original line>"}`.
|
|
104
|
+
|
|
105
|
+
### Supported input formats
|
|
106
|
+
|
|
107
|
+
Each line may start with a syslog `<PRI>` value (added as `syslog_pri`),
|
|
108
|
+
followed by one of:
|
|
109
|
+
|
|
110
|
+
| Header | Example | Added fields |
|
|
111
|
+
|--------|---------|--------------|
|
|
112
|
+
| Traditional (RFC 3164 style) | `Dec 5 10:00:00 fw01 tag CEF:0\|...` | `syslog_timestamp`, `syslog_hostname`, `syslog_tag` |
|
|
113
|
+
| RFC 5424 | `1 2026-12-05T10:00:00+09:00 fw01 app 1234 ID47 - CEF:0\|...` | `syslog_version`, `syslog_timestamp`, `syslog_hostname`, `syslog_tag` (APP-NAME), `syslog_procid`, `syslog_msgid`, `syslog_structured_data` |
|
|
114
|
+
| None | `CEF:0\|...` | - |
|
|
115
|
+
|
|
116
|
+
The syslog timestamp becomes the event time. Without one (no header, or the
|
|
117
|
+
RFC 5424 `-` NILVALUE) the current time is used.
|
|
118
|
+
|
|
119
|
+
The `<PRI>`, RFC 5424 and header-less formats are supported from 1.1.0.
|
|
120
|
+
|
|
121
|
+
## Parameters
|
|
122
|
+
|
|
123
|
+
| Name | Type | Default | Description |
|
|
124
|
+
|---------------------------|---------|-----------------------------------------------|-------------|
|
|
125
|
+
| `log_format` | string | `syslog` | Input format. Only `syslog` is supported. |
|
|
126
|
+
| `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. |
|
|
127
|
+
| `syslog_timestamp_format` | string | `\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}` | Regular expression that matches the timestamp of the traditional syslog header. The default matches `Dec 5 10:00:00`. |
|
|
128
|
+
| `cef_version` | integer | `0` | CEF version in the `CEF:<version>` header. |
|
|
129
|
+
| `parse_strict_mode` | bool | `true` | Only treat known CEF keys as keys. See below. |
|
|
130
|
+
| `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. |
|
|
131
|
+
| `output_raw_field` | bool | `false` | Also add the original line as `raw` when parsing succeeds. |
|
|
132
|
+
| `cef_additional_keys` | array | `[]` | Extra keys treated as known keys in strict mode, e.g. `cef_additional_keys vendorKey1,vendorKey2`. (1.1.0+) |
|
|
133
|
+
|
|
134
|
+
### Strict mode
|
|
135
|
+
|
|
136
|
+
CEF extension values may contain spaces and `=`. With `parse_strict_mode true`,
|
|
137
|
+
only the keys listed in `cef_keyfilename` start a new field, so for
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
cs1=test cs2=foo hoge=fuga cs3=bar
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`cs2` becomes `foo hoge=fuga`. With `parse_strict_mode false`, every `key=`
|
|
144
|
+
starts a new field, so `cs2` becomes `foo` and an extra `hoge` field with
|
|
145
|
+
`fuga` is added.
|
|
146
|
+
|
|
147
|
+
The default key file contains the ArcSight dictionary and the Palo Alto
|
|
148
|
+
Networks PAN-OS keys. In strict mode, other vendor-specific keys are appended
|
|
149
|
+
to the previous value (a key at the start of the extension still becomes a
|
|
150
|
+
field). Add them with `cef_additional_keys`, use your own key file, or set
|
|
151
|
+
`parse_strict_mode false`.
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
The easiest way is the included [Dev Container](.devcontainer/devcontainer.json)
|
|
156
|
+
(VS Code / GitHub Codespaces), which sets up Ruby and runs `bundle install`:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
bundle exec rake spec
|
|
160
|
+
|
|
161
|
+
# with a local coverage report (coverage/index.html)
|
|
162
|
+
COVERAGE=1 bundle exec rake spec
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Without the Dev Container, any Docker host works:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
docker run --rm -v "$PWD":/app -w /app ruby:3.4 \
|
|
169
|
+
bash -c "bundle install && bundle exec rake spec"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Bug reports and pull requests are welcome on
|
|
173
|
+
[GitHub](https://github.com/lunardial/fluent-plugin-parser_cef).
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE).
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
|
@@ -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
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
|
|
@@ -171,3 +171,53 @@ cef_key_names_for_event_consumers:
|
|
|
171
171
|
- sourceZoneExternalID
|
|
172
172
|
- sourceZoneURI
|
|
173
173
|
|
|
174
|
+
# CEF Key Names For Palo Alto Networks PAN-OS
|
|
175
|
+
cef_key_names_for_paloalto:
|
|
176
|
+
- slocation
|
|
177
|
+
- dlocation
|
|
178
|
+
- PanOSPacketsReceived
|
|
179
|
+
- PanOSPacketsSent
|
|
180
|
+
- PanOSThreatCategory
|
|
181
|
+
- PanOSThreatID
|
|
182
|
+
- PanOSThreatName
|
|
183
|
+
- PanOSThreatDomain
|
|
184
|
+
- PanOSSeverity
|
|
185
|
+
- PanOSReferer
|
|
186
|
+
- PanOSURLCatList
|
|
187
|
+
- PanOSLogTimeStamp
|
|
188
|
+
- PanOSVirtualSystem
|
|
189
|
+
- PanOSEventID
|
|
190
|
+
- PanOSStage
|
|
191
|
+
- PanOSAuthMethod
|
|
192
|
+
- PanOSTunnelType
|
|
193
|
+
- PanOSSourceUserName
|
|
194
|
+
- PanOSSourceRegion
|
|
195
|
+
- PanOSEndpointDeviceName
|
|
196
|
+
- PanOSPublicIPv4
|
|
197
|
+
- PanOSPublicIPv6
|
|
198
|
+
- PanOSPrivateIPv4
|
|
199
|
+
- PanOSPrivateIPv6
|
|
200
|
+
- PanOSHostID
|
|
201
|
+
- PanOSDeviceSN
|
|
202
|
+
- PanOSGlobalProtectClientVersion
|
|
203
|
+
- PanOSEndpointOSType
|
|
204
|
+
- PanOSEndpointOSVersion
|
|
205
|
+
- PanOSCountOfRepeats
|
|
206
|
+
- PanOSQuarantineReason
|
|
207
|
+
- PanOSConnectionError
|
|
208
|
+
- PanOSDescription
|
|
209
|
+
- PanOSEventStatus
|
|
210
|
+
- PanOSGPGatewayLocation
|
|
211
|
+
- PanOSLoginDuration
|
|
212
|
+
- PanOSConnectionMethod
|
|
213
|
+
- PanOSConnectionErrorID
|
|
214
|
+
- PanOSPortal
|
|
215
|
+
- PanOSSequenceNo
|
|
216
|
+
- PanOSActionFlags
|
|
217
|
+
- PanOSTimeGeneratedHighResolution
|
|
218
|
+
- PanOSGatewaySelectionType
|
|
219
|
+
- PanOSSSLResponseTime
|
|
220
|
+
- PanOSGatewayPriority
|
|
221
|
+
- PanOSAttemptedGateways
|
|
222
|
+
- PanOSGateway
|
|
223
|
+
- PanOSEndpointDeviceSN
|
|
@@ -16,11 +16,12 @@ module Fluent
|
|
|
16
16
|
config_param :parse_strict_mode, :bool, :default => true
|
|
17
17
|
config_param :cef_keyfilename, :string, :default => 'config/cef_version_0_keys.yaml'
|
|
18
18
|
config_param :output_raw_field, :bool, :default => false
|
|
19
|
+
config_param :cef_additional_keys, :array, :value_type => :string, :default => []
|
|
19
20
|
|
|
20
21
|
def configure(conf)
|
|
21
22
|
super
|
|
22
23
|
@key_value_format_regexp = /([^\s=]+)=(.*?)(?:(?=[^\s=]+=)|\z)/
|
|
23
|
-
@
|
|
24
|
+
@valid_format_regexps = create_valid_format_regexps
|
|
24
25
|
@utc_offset = get_utc_offset(@log_utc_offset)
|
|
25
26
|
begin
|
|
26
27
|
if @parse_strict_mode
|
|
@@ -31,6 +32,7 @@ module Fluent
|
|
|
31
32
|
end
|
|
32
33
|
@keys_array = []
|
|
33
34
|
yaml_fieldinfo.each {|_key, value| @keys_array.concat(value) }
|
|
35
|
+
@keys_array.concat(@cef_additional_keys)
|
|
34
36
|
$log.info "running with strict mode, #{@keys_array.length} keys are valid."
|
|
35
37
|
else
|
|
36
38
|
$log.info "running without strict mode"
|
|
@@ -50,14 +52,23 @@ module Fluent
|
|
|
50
52
|
text.force_encoding("utf-8")
|
|
51
53
|
replaced_text = text.scrub('?')
|
|
52
54
|
record = {}
|
|
53
|
-
record_overview =
|
|
55
|
+
record_overview = nil
|
|
56
|
+
@valid_format_regexps.each do |regexp|
|
|
57
|
+
record_overview = regexp.match(replaced_text)
|
|
58
|
+
break unless record_overview.nil?
|
|
59
|
+
end
|
|
54
60
|
if record_overview.nil?
|
|
55
61
|
yield Engine.now, { "raw" => replaced_text }
|
|
56
62
|
return
|
|
57
63
|
end
|
|
58
|
-
|
|
64
|
+
timestamp = record_overview.names.include?("syslog_timestamp") ? record_overview["syslog_timestamp"] : nil
|
|
65
|
+
time = get_unixtime_with_utc_offset(timestamp, @utc_offset)
|
|
59
66
|
begin
|
|
60
|
-
|
|
67
|
+
# Optional parts that are absent (e.g. <PRI> or the syslog header)
|
|
68
|
+
# are not added to the record.
|
|
69
|
+
record_overview.names.each do |key|
|
|
70
|
+
record[key] = record_overview[key] unless record_overview[key].nil?
|
|
71
|
+
end
|
|
61
72
|
text_cef_extension = record_overview["cef_extension"]
|
|
62
73
|
record.delete("cef_extension")
|
|
63
74
|
rescue
|
|
@@ -88,14 +99,29 @@ module Fluent
|
|
|
88
99
|
return utc_offset
|
|
89
100
|
end
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
# Formats are tried in this order:
|
|
103
|
+
# 1. traditional (RFC 3164 style) syslog header
|
|
104
|
+
# 2. RFC 5424 syslog header
|
|
105
|
+
# 3. no syslog header (the line starts with "CEF:")
|
|
106
|
+
# Each may be preceded by a syslog <PRI> value.
|
|
107
|
+
def create_valid_format_regexps()
|
|
92
108
|
case @log_format
|
|
93
109
|
when "syslog"
|
|
94
|
-
|
|
110
|
+
syslog_pri = /(?:<(?<syslog_pri>\d{1,3})>)?/
|
|
111
|
+
rfc3164_header = /
|
|
95
112
|
(?<syslog_timestamp>#{@syslog_timestamp_format})\s
|
|
96
113
|
(?<syslog_hostname>\S+)\s
|
|
97
114
|
(?<syslog_tag>\S*)\s*
|
|
98
115
|
/x
|
|
116
|
+
rfc5424_header = /
|
|
117
|
+
(?<syslog_version>[1-9]\d{0,2})\s
|
|
118
|
+
(?<syslog_timestamp>\S+)\s
|
|
119
|
+
(?<syslog_hostname>\S+)\s
|
|
120
|
+
(?<syslog_tag>\S+)\s
|
|
121
|
+
(?<syslog_procid>\S+)\s
|
|
122
|
+
(?<syslog_msgid>\S+)\s
|
|
123
|
+
(?<syslog_structured_data>-|(?:\[(?:[^\]\\]|\\.)*\])+)\s
|
|
124
|
+
/x
|
|
99
125
|
cef_header = /
|
|
100
126
|
CEF:(?<cef_version>#{@cef_version})\|
|
|
101
127
|
(?<cef_device_vendor>[^|]*)\|
|
|
@@ -105,24 +131,28 @@ module Fluent
|
|
|
105
131
|
(?<cef_name>[^|]*)\|
|
|
106
132
|
(?<cef_severity>[^|]*)
|
|
107
133
|
/x
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
134
|
+
[rfc3164_header, rfc5424_header, nil].map do |syslog_header|
|
|
135
|
+
Regexp.new(/
|
|
136
|
+
\A
|
|
137
|
+
#{syslog_pri}
|
|
138
|
+
#{syslog_header}
|
|
139
|
+
(?:\u{feff})?
|
|
140
|
+
#{cef_header}\|
|
|
141
|
+
(?<cef_extension>.*)
|
|
142
|
+
\z
|
|
143
|
+
/x)
|
|
144
|
+
end
|
|
116
145
|
else
|
|
117
146
|
raise Fluent::ConfigError, "#{@log_format} is unknown format"
|
|
118
147
|
end
|
|
119
|
-
return Regexp.new(valid_format_regexp)
|
|
120
148
|
end
|
|
121
149
|
|
|
122
150
|
def get_unixtime_with_utc_offset(timestamp, utc_offset)
|
|
151
|
+
# No syslog header, or the RFC 5424 NILVALUE
|
|
152
|
+
return Engine.now if timestamp.nil? || timestamp == "-"
|
|
123
153
|
unixtime = nil
|
|
124
154
|
begin
|
|
125
|
-
if timestamp =~ /[-+]\d{2}:?\d{2}\z/
|
|
155
|
+
if timestamp =~ /(?:Z|[-+]\d{2}:?\d{2})\z/
|
|
126
156
|
unixtime = Time.parse(timestamp).to_i
|
|
127
157
|
else
|
|
128
158
|
unixtime = Time.parse("#{timestamp} #{utc_offset}").to_i
|
|
@@ -146,7 +176,9 @@ module Fluent
|
|
|
146
176
|
begin
|
|
147
177
|
last_valid_key_name = nil
|
|
148
178
|
text.scan(@key_value_format_regexp) do |key, value|
|
|
149
|
-
|
|
179
|
+
# A key that is not in the key list is treated as part of the
|
|
180
|
+
# previous value, unless no known key has been seen yet.
|
|
181
|
+
if @keys_array.include?(key) || last_valid_key_name.nil?
|
|
150
182
|
record[key] = value
|
|
151
183
|
record[last_valid_key_name].rstrip! unless last_valid_key_name.nil?
|
|
152
184
|
last_valid_key_name = key
|
|
@@ -2,6 +2,9 @@
|
|
|
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)
|
|
5
8
|
require 'fluent/test/driver/parser'
|
|
6
9
|
|
|
7
10
|
RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
@@ -190,7 +193,8 @@ RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
|
190
193
|
"cef_device_version" => "Version",
|
|
191
194
|
"cef_device_event_class_id" => "ID",
|
|
192
195
|
"cef_name" => "Name",
|
|
193
|
-
"cef_severity" => "Severity"
|
|
196
|
+
"cef_severity" => "Severity",
|
|
197
|
+
"foo" => "bar" }]}
|
|
194
198
|
end
|
|
195
199
|
context "timestamp is rfc3339, UTC+3" do
|
|
196
200
|
let (:config) {%[
|
|
@@ -218,7 +222,8 @@ RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
|
218
222
|
"cef_device_version" => "Version",
|
|
219
223
|
"cef_device_event_class_id" => "ID",
|
|
220
224
|
"cef_name" => "Name",
|
|
221
|
-
"cef_severity" => "Severity"
|
|
225
|
+
"cef_severity" => "Severity",
|
|
226
|
+
"foo" => "bar" }]}
|
|
222
227
|
end
|
|
223
228
|
context "timestamp is rfc3339, UTC+0" do
|
|
224
229
|
let (:config) {%[
|
|
@@ -246,7 +251,8 @@ RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
|
246
251
|
"cef_device_version" => "Version",
|
|
247
252
|
"cef_device_event_class_id" => "ID",
|
|
248
253
|
"cef_name" => "Name",
|
|
249
|
-
"cef_severity" => "Severity"
|
|
254
|
+
"cef_severity" => "Severity",
|
|
255
|
+
"foo" => "bar" }]}
|
|
250
256
|
end
|
|
251
257
|
context "utc offset set to +04:00" do
|
|
252
258
|
let (:config) {%[
|
|
@@ -373,5 +379,162 @@ RSpec.describe Fluent::Plugin::CommonEventFormatParser do
|
|
|
373
379
|
"dpt" => "80",
|
|
374
380
|
"msg" => "\xe3\x2e\x2e\x2e".scrub('?') }]}
|
|
375
381
|
end
|
|
382
|
+
|
|
383
|
+
context "other syslog formats" do
|
|
384
|
+
CEF_HEADER_FIELDS = {
|
|
385
|
+
"cef_version" => "0",
|
|
386
|
+
"cef_device_vendor" => "Vendor",
|
|
387
|
+
"cef_device_product" => "Product",
|
|
388
|
+
"cef_device_version" => "Version",
|
|
389
|
+
"cef_device_event_class_id" => "ID",
|
|
390
|
+
"cef_name" => "Name",
|
|
391
|
+
"cef_severity" => "Severity",
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
def parse_text(text, conf = %[log_utc_offset +09:00])
|
|
395
|
+
parsed = nil
|
|
396
|
+
create_driver(conf).instance.parse(text) { |time, record| parsed = [time, record] }
|
|
397
|
+
parsed
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
before :each do
|
|
401
|
+
@now = Fluent::EventTime.now
|
|
402
|
+
allow(Fluent::Engine).to receive(:now).and_return(@now)
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
it "parses a traditional syslog header preceded by <PRI>" do
|
|
406
|
+
time, record = parse_text("<134>Dec 12 10:11:12 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1")
|
|
407
|
+
expect(time).to eq Time.parse("Dec 12 10:11:12 +09:00").to_i
|
|
408
|
+
expect(record).to eq({
|
|
409
|
+
"syslog_pri" => "134",
|
|
410
|
+
"syslog_timestamp" => "Dec 12 10:11:12",
|
|
411
|
+
"syslog_hostname" => "hostname",
|
|
412
|
+
"syslog_tag" => "tag",
|
|
413
|
+
"src" => "192.0.2.1",
|
|
414
|
+
}.merge(CEF_HEADER_FIELDS))
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
it "parses CEF without a syslog header and uses the current time" do
|
|
418
|
+
time, record = parse_text("CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1 act=blocked")
|
|
419
|
+
expect(time).to eq @now
|
|
420
|
+
expect(record).to eq({ "src" => "192.0.2.1", "act" => "blocked" }.merge(CEF_HEADER_FIELDS))
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
it "parses CEF preceded only by <PRI>" do
|
|
424
|
+
time, record = parse_text("<164>CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1")
|
|
425
|
+
expect(time).to eq @now
|
|
426
|
+
expect(record).to eq({ "syslog_pri" => "164", "src" => "192.0.2.1" }.merge(CEF_HEADER_FIELDS))
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
it "parses an RFC 5424 header with NILVALUE fields" do
|
|
430
|
+
time, record = parse_text("<164>1 2024-10-02T14:35:05+02:00 fw1 - - - - CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1 dpt=443")
|
|
431
|
+
expect(time).to eq Time.parse("2024-10-02T14:35:05+02:00").to_i
|
|
432
|
+
expect(record).to eq({
|
|
433
|
+
"syslog_pri" => "164",
|
|
434
|
+
"syslog_version" => "1",
|
|
435
|
+
"syslog_timestamp" => "2024-10-02T14:35:05+02:00",
|
|
436
|
+
"syslog_hostname" => "fw1",
|
|
437
|
+
"syslog_tag" => "-",
|
|
438
|
+
"syslog_procid" => "-",
|
|
439
|
+
"syslog_msgid" => "-",
|
|
440
|
+
"syslog_structured_data" => "-",
|
|
441
|
+
"src" => "192.0.2.1",
|
|
442
|
+
"dpt" => "443",
|
|
443
|
+
}.merge(CEF_HEADER_FIELDS))
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
it "parses an RFC 5424 header with structured data and a UTC timestamp, without <PRI>" do
|
|
447
|
+
text = '1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog 1234 ID47 [exampleSDID@32473 iut="3" eventSource="App\\]lication"][x@1 a="b"] CEF:0|Vendor|Product|Version|ID|Name|Severity|msg=hello'
|
|
448
|
+
time, record = parse_text(text)
|
|
449
|
+
expect(time).to eq Time.parse("2003-10-11T22:14:15.003Z").to_i
|
|
450
|
+
expect(record).to eq({
|
|
451
|
+
"syslog_version" => "1",
|
|
452
|
+
"syslog_timestamp" => "2003-10-11T22:14:15.003Z",
|
|
453
|
+
"syslog_hostname" => "mymachine.example.com",
|
|
454
|
+
"syslog_tag" => "evntslog",
|
|
455
|
+
"syslog_procid" => "1234",
|
|
456
|
+
"syslog_msgid" => "ID47",
|
|
457
|
+
"syslog_structured_data" => '[exampleSDID@32473 iut="3" eventSource="App\\]lication"][x@1 a="b"]',
|
|
458
|
+
"msg" => "hello",
|
|
459
|
+
}.merge(CEF_HEADER_FIELDS))
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
it "uses the current time for an RFC 5424 NILVALUE timestamp" do
|
|
463
|
+
time, record = parse_text("1 - fw1 app - - - CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1")
|
|
464
|
+
expect(time).to eq @now
|
|
465
|
+
expect(record["syslog_timestamp"]).to eq "-"
|
|
466
|
+
expect(record["src"]).to eq "192.0.2.1"
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
it "still emits raw for text that only contains CEF after an unknown prefix" do
|
|
470
|
+
time, record = parse_text("garbage CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1")
|
|
471
|
+
expect(record).to eq({ "raw" => "garbage CEF:0|Vendor|Product|Version|ID|Name|Severity|src=192.0.2.1" })
|
|
472
|
+
end
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
context "strict mode and unknown keys" do
|
|
476
|
+
def parse_extension(extension, conf = "")
|
|
477
|
+
parsed = nil
|
|
478
|
+
create_driver(conf).instance.parse("Dec 12 10:11:12 hostname tag CEF:0|Vendor|Product|Version|ID|Name|Severity|#{extension}") do |_time, record|
|
|
479
|
+
parsed = record.reject { |key, _| key.start_with?("syslog_", "cef_") }
|
|
480
|
+
end
|
|
481
|
+
parsed
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
it "keeps the extension when the first key is unknown" do
|
|
485
|
+
expect(parse_extension("vendorKey=1 src=192.0.2.1 act=blocked")).to eq(
|
|
486
|
+
"vendorKey" => "1", "src" => "192.0.2.1", "act" => "blocked")
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
it "appends unknown keys after a known key to the previous value" do
|
|
490
|
+
expect(parse_extension("src=192.0.2.1 vendorKey=1 act=blocked")).to eq(
|
|
491
|
+
"src" => "192.0.2.1 vendorKey=1", "act" => "blocked")
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
it "treats keys listed in cef_additional_keys as known keys" do
|
|
495
|
+
conf = %[cef_additional_keys vendorKey,otherKey]
|
|
496
|
+
expect(parse_extension("src=192.0.2.1 vendorKey=1 otherKey=a b act=blocked", conf)).to eq(
|
|
497
|
+
"src" => "192.0.2.1", "vendorKey" => "1", "otherKey" => "a b", "act" => "blocked")
|
|
498
|
+
end
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
context "Palo Alto Networks keys" do
|
|
502
|
+
let (:config) {%[
|
|
503
|
+
log_utc_offset +09:00
|
|
504
|
+
]}
|
|
505
|
+
|
|
506
|
+
def parse_paloalto(text)
|
|
507
|
+
parsed = nil
|
|
508
|
+
create_driver(config).instance.parse(text) { |time, record| parsed = [time, record] }
|
|
509
|
+
parsed
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
it "parses a PAN-OS log with an empty extension" do
|
|
513
|
+
time, record = parse_paloalto("Jan 1 00:00:00 Paloalto - CEF:0|Palo Alto Networks|PAN-OS|10.1.8|TRAFFIC|end|0|")
|
|
514
|
+
expect(time).to eq Time.parse("Jan 1 00:00:00 +09:00").to_i
|
|
515
|
+
expect(record).to eq({
|
|
516
|
+
"syslog_timestamp" => "Jan 1 00:00:00",
|
|
517
|
+
"syslog_hostname" => "Paloalto",
|
|
518
|
+
"syslog_tag" => "-",
|
|
519
|
+
"cef_version" => "0",
|
|
520
|
+
"cef_device_vendor" => "Palo Alto Networks",
|
|
521
|
+
"cef_device_product" => "PAN-OS",
|
|
522
|
+
"cef_device_version" => "10.1.8",
|
|
523
|
+
"cef_device_event_class_id" => "TRAFFIC",
|
|
524
|
+
"cef_name" => "end",
|
|
525
|
+
"cef_severity" => "0",
|
|
526
|
+
})
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
it "splits PAN-OS specific keys in strict mode" do
|
|
530
|
+
time, record = parse_paloalto("Jan 1 00:00:00 Paloalto - CEF:0|Palo Alto Networks|PAN-OS|10.1.7|TRAFFIC|start|0|deviceExternalId=000000000000001 PanOSPacketsReceived=0 PanOSPacketsSent=1")
|
|
531
|
+
expect(time).to eq Time.parse("Jan 1 00:00:00 +09:00").to_i
|
|
532
|
+
expect(record).to include(
|
|
533
|
+
"deviceExternalId" => "000000000000001",
|
|
534
|
+
"PanOSPacketsReceived" => "0",
|
|
535
|
+
"PanOSPacketsSent" => "1",
|
|
536
|
+
)
|
|
537
|
+
end
|
|
538
|
+
end
|
|
376
539
|
end
|
|
377
540
|
end
|
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: 1.
|
|
4
|
+
version: 1.1.0
|
|
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
|
|
@@ -34,30 +33,30 @@ dependencies:
|
|
|
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.6.13
|
|
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
|