fluent-auditify 0.1.0 → 0.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e234cfa52ee9302d33cad2f099be103df74ee3d34d58130be1ab8a540e2baed
|
|
4
|
+
data.tar.gz: 0241bb9816a27f16304248198ba9186e72d504819a63abe1fb2131cf9a0023e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d78ad3f05f6d5c3d9a6cde0c8791ab39ae3b65801a8d918b464486822b857486197cd2bbf6b3061a116473cfb35664ce4de2e5e432753b03f6a58e70fd72f5ba
|
|
7
|
+
data.tar.gz: 1e10a6072de19e430828550bc33c7fe3b426344bc8c838fc544d1e4a71291739bdba5276d8ad602b1e44ed99e197200a965ca301bda39d65b0f7544dfc59b09c
|
data/CHANGELOG.md
CHANGED
|
@@ -47,6 +47,15 @@ module Fluent
|
|
|
47
47
|
require plugin_path
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
Gem::Specification.each { |spec|
|
|
52
|
+
if spec.name.start_with?('fluent-auditify-plugin-')
|
|
53
|
+
Dir.glob("#{spec.full_gem_path}/lib/fluent/auditify/plugin/conf_*.rb") do |path|
|
|
54
|
+
@logger.debug("Loading <#{path}>") if @logger
|
|
55
|
+
require path
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
}
|
|
50
59
|
end
|
|
51
60
|
|
|
52
61
|
def builtin_plugin_paths
|
|
@@ -87,6 +96,21 @@ module Fluent
|
|
|
87
96
|
end
|
|
88
97
|
end
|
|
89
98
|
|
|
99
|
+
def supported_file_extension?(plugin, config)
|
|
100
|
+
unless plugin.respond_to?(:supported_file_extension?)
|
|
101
|
+
@logger.info("Plugin: <#{plugin.class}> must implement supported_file_extension?")
|
|
102
|
+
return false
|
|
103
|
+
end
|
|
104
|
+
if config.end_with?('.yml', '.yaml') and
|
|
105
|
+
plugin.supported_file_extension?.include?(:yaml)
|
|
106
|
+
return true
|
|
107
|
+
elsif config.end_with?('.conf') and
|
|
108
|
+
plugin.supported_file_extension?.include?(:conf)
|
|
109
|
+
return true
|
|
110
|
+
end
|
|
111
|
+
false
|
|
112
|
+
end
|
|
113
|
+
|
|
90
114
|
def skip_plugin?(plugin)
|
|
91
115
|
unless supported_plugin?(plugin)
|
|
92
116
|
return true
|
|
@@ -123,15 +147,23 @@ module Fluent
|
|
|
123
147
|
|
|
124
148
|
def evacuate(options={})
|
|
125
149
|
@workspace_dir = Dir.mktmpdir('fluent-auditify')
|
|
150
|
+
@logger.debug("Create workspace under <#{@workspace_dir}>")
|
|
126
151
|
@base_dir = File.dirname(options[:config])
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
|
|
153
|
+
if options[:config].end_with?('.conf')
|
|
154
|
+
parser = Fluent::Auditify::Parser::V1ConfigParser.new
|
|
155
|
+
object = parser.parse(File.read(options[:config]))
|
|
156
|
+
|
|
157
|
+
# copy configuration files into workspace
|
|
158
|
+
touched = [options[:config]]
|
|
159
|
+
touched << collect_related_config_files(object).collect { |v| File.join(@base_dir, v) }
|
|
160
|
+
touched.flatten!
|
|
161
|
+
@logger.debug("Copy configuration files: <#{touched}>")
|
|
162
|
+
FileUtils.cp(touched, @workspace_dir)
|
|
163
|
+
else
|
|
164
|
+
@logger.debug("Copy configuration files: <#{options[:config]}>")
|
|
165
|
+
FileUtils.cp(options[:config], @workspace_dir)
|
|
166
|
+
end
|
|
135
167
|
end
|
|
136
168
|
|
|
137
169
|
def dispatch(options={})
|
|
@@ -140,10 +172,8 @@ module Fluent
|
|
|
140
172
|
next if skip_plugin?(plugin)
|
|
141
173
|
|
|
142
174
|
config_path = File.join(@workspace_dir, File.basename(options[:config]))
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
unless ext.any?(ext_symbol)
|
|
146
|
-
@logger.debug("#{plugin.class} does not support #{config_path}")
|
|
175
|
+
unless supported_file_extension?(plugin, config_path)
|
|
176
|
+
@logger.debug("<#{plugin.class}> is not applicable to <#{config_path}>")
|
|
147
177
|
next
|
|
148
178
|
end
|
|
149
179
|
|