diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-02-24 14:02:47 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-02-24 14:02:47 +0000 |
| commit | d5ce98f9930d14aa28a05a92b173e9882ad8721b (patch) | |
| tree | 95d38b80949dc3ff2cb285419c98b1a2e9146450 /docker/heka/plugins/decoders | |
| parent | 3aa24d7857bf950344ee6a23cbfd49dde9ee23a5 (diff) | |
| parent | b9d07a04dac5075a98727271312f7f9855f1f328 (diff) | |
| download | kolla-d5ce98f9930d14aa28a05a92b173e9882ad8721b.tar.gz kolla-d5ce98f9930d14aa28a05a92b173e9882ad8721b.zip | |
Merge "Remove heka image"
Diffstat (limited to 'docker/heka/plugins/decoders')
| -rw-r--r-- | docker/heka/plugins/decoders/os_aodh_apache_log.lua | 71 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_ceilometer_apache_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_gnocchi_apache_log.lua | 71 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_grafana_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_horizon_apache_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_keystone_apache_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_mysql_log.lua | 50 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_openstack_log.lua | 140 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_panko_apache_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_rabbitmq_log.lua | 72 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_swift_log.lua | 49 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_syslog.lua | 55 | ||||
| -rw-r--r-- | docker/heka/plugins/decoders/os_zaqar_apache_log.lua | 72 |
13 files changed, 0 insertions, 940 deletions
diff --git a/docker/heka/plugins/decoders/os_aodh_apache_log.lua b/docker/heka/plugins/decoders/os_aodh_apache_log.lua deleted file mode 100644 index d60a0369d..000000000 --- a/docker/heka/plugins/decoders/os_aodh_apache_log.lua +++ /dev/null @@ -1,71 +0,0 @@ --- Copyright 2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.aodh' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_ceilometer_apache_log.lua b/docker/heka/plugins/decoders/os_ceilometer_apache_log.lua deleted file mode 100644 index bf9322c67..000000000 --- a/docker/heka/plugins/decoders/os_ceilometer_apache_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - -- logger is either "ceilometer-apache-public" or "ceilometer-apache-admin" - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.ceilometer' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_gnocchi_apache_log.lua b/docker/heka/plugins/decoders/os_gnocchi_apache_log.lua deleted file mode 100644 index d9c1f3f8d..000000000 --- a/docker/heka/plugins/decoders/os_gnocchi_apache_log.lua +++ /dev/null @@ -1,71 +0,0 @@ --- Copyright 2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.gnocchi' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_grafana_log.lua b/docker/heka/plugins/decoders/os_grafana_log.lua deleted file mode 100644 index 794145d6b..000000000 --- a/docker/heka/plugins/decoders/os_grafana_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015-2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -local dt = require "date_time" -local l = require 'lpeg' -l.locale(l) - -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = nil, -} - --- Grafana message logs are formatted like this: --- =ERROR REPORT==== 2-Jan-2015::09:17:22 === --- Blabla --- Blabla --- -local message = l.Cg(patt.Message / utils.chomp, "Message") --- The token before 'REPORT' isn't standardized so it can be a valid severity --- level as 'INFO' or 'ERROR' but also 'CRASH' or 'SUPERVISOR'. -local severity = l.Cg(l.R"AZ"^1, "SeverityLabel") -local day = l.R"13" * l.R"09" + l.R"19" -local datetime = l.Cg(day, "day") * patt.dash * dt.date_mabbr * patt.dash * dt.date_fullyear * - "::" * dt.rfc3339_partial_time -local timestamp = l.Cg(l.Ct(datetime)/ dt.time_to_ns, "Timestamp") - -local grammar = l.Ct("=" * severity * " REPORT==== " * timestamp * " ===" * l.P'\n' * message) - -function process_message () - local log = read_message("Payload") - - local m = grammar:match(log) - if not m then - return -1 - end - - msg.Timestamp = m.Timestamp - msg.Payload = m.Message - msg.Logger = read_message("Logger") - - if utils.label_to_severity_map[m.SeverityLabel] then - msg.Severity = utils.label_to_severity_map[m.SeverityLabel] - elseif m.SeverityLabel == 'CRASH' then - msg.Severity = 2 -- CRITICAL - else - msg.Severity = 5 -- NOTICE - end - - msg.Fields = {} - msg.Fields.severity_label = utils.severity_to_label_map[msg.Severity] - msg.Fields.programname = 'grafana' - - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_horizon_apache_log.lua b/docker/heka/plugins/decoders/os_horizon_apache_log.lua deleted file mode 100644 index e9421d0aa..000000000 --- a/docker/heka/plugins/decoders/os_horizon_apache_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - -- logger is either "horizon-apache-public" or "horizon-apache-admin" - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.horizon' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_keystone_apache_log.lua b/docker/heka/plugins/decoders/os_keystone_apache_log.lua deleted file mode 100644 index 8136ec052..000000000 --- a/docker/heka/plugins/decoders/os_keystone_apache_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - -- logger is either "keystone-apache-public" or "keystone-apache-admin" - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.keystone' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_mysql_log.lua b/docker/heka/plugins/decoders/os_mysql_log.lua deleted file mode 100644 index b5869d188..000000000 --- a/docker/heka/plugins/decoders/os_mysql_log.lua +++ /dev/null @@ -1,50 +0,0 @@ --- Copyright 2015-2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -require "string" -local l = require 'lpeg' -l.locale(l) - -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = {}, - Severity = nil, -} - -local sp = patt.sp -local colon = patt.colon - --- mysqld logs are cranky,the date is YYMMMDD, the hours have no leading zero and the "real" severity level is enclosed by square brackets... -local mysql_grammar = l.Ct(l.digit^-6 * sp^1 * l.digit^-2 * colon * l.digit^-2 * colon * l.digit^-2 * sp^1 * l.P"[" * l.Cg(l.R("az", "AZ")^0 / string.upper, "SeverityLabel") * l.P"]" * sp^1 * l.Cg(patt.Message, "Message")) - - -function process_message () - local log = read_message("Payload") - local logger = read_message("Logger") - - local m = mysql_grammar:match(log) - if not m then return -1 end - - msg.Logger = logger - msg.Payload = m.Message - msg.Fields.severity_label = m.SeverityLabel - - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_openstack_log.lua b/docker/heka/plugins/decoders/os_openstack_log.lua deleted file mode 100644 index d8f4446ee..000000000 --- a/docker/heka/plugins/decoders/os_openstack_log.lua +++ /dev/null @@ -1,140 +0,0 @@ --- Copyright 2015-2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -require "string" -require "table" -local l = require 'lpeg' -l.locale(l) - -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = nil, -} - --- traceback_lines is a reference to a table used to accumulate lines of --- a Traceback. traceback_key represent the key of the Traceback lines --- being accumulated in traceback_lines. This is used to know when to --- stop accumulating and inject the Heka message. -local traceback_key = nil -local traceback_lines = nil - -function prepare_message (service, timestamp, pid, severity_label, - python_module, programname, payload) - msg.Logger = 'openstack.' .. service - msg.Timestamp = timestamp - msg.Payload = payload - msg.Pid = pid - msg.Severity = utils.label_to_severity_map[severity_label] or 7 - msg.Fields = {} - msg.Fields.severity_label = severity_label - msg.Fields.python_module = python_module - msg.Fields.programname = programname - msg.Payload = payload -end - --- OpenStack log messages are of this form: --- 2015-11-30 08:38:59.306 3434 INFO oslo_service.periodic_task [-] Blabla... --- --- [-] is the "request" part, it can take multiple forms. - -function process_message () - - -- Logger is of form "<service>_<program>" (e.g. "nova_nova-api", - -- "neutron_l3-agent"). - local logger = read_message("Logger") - local service, program = string.match(logger, '([^_]+)_(.+)') - - local log = read_message("Payload") - local m - - m = patt.openstack:match(log) - if not m then - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) - end - - local key = { - Timestamp = m.Timestamp, - Pid = m.Pid, - SeverityLabel = m.SeverityLabel, - PythonModule = m.PythonModule, - service = service, - program = program, - } - - if traceback_key ~= nil then - -- If traceback_key is not nil then it means we've started accumulated - -- lines of a Python traceback. We keep accumulating the traceback - -- lines util we get a different log key. - if utils.table_equal(traceback_key, key) then - table.insert(traceback_lines, m.Message) - return 0 - else - prepare_message(traceback_key.service, traceback_key.Timestamp, - traceback_key.Pid, traceback_key.SeverityLabel, - traceback_key.PythonModule, traceback_key.program, - table.concat(traceback_lines, '')) - traceback_key = nil - traceback_lines = nil - -- Ignore safe_inject_message status code here to still get a - -- chance to inject the current log message. - utils.safe_inject_message(msg) - end - end - - if patt.traceback:match(m.Message) then - -- Python traceback detected, begin accumulating the lines making - -- up the traceback. - traceback_key = key - traceback_lines = {} - table.insert(traceback_lines, m.Message) - return 0 - end - - prepare_message(service, m.Timestamp, m.Pid, m.SeverityLabel, m.PythonModule, - program, m.Message) - - m = patt.openstack_request_context:match(msg.Payload) - if m then - msg.Fields.request_id = m.RequestId - if m.UserId then - msg.Fields.user_id = m.UserId - end - if m.TenantId then - msg.Fields.tenant_id = m.TenantId - end - end - - m = patt.openstack_http:match(msg.Payload) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_status = m.http_status - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - msg.Fields.http_response_size = m.http_response_size - msg.Fields.http_response_time = m.http_response_time - m = patt.ip_address:match(msg.Payload) - if m then - msg.Fields.http_client_ip_address = m.ip_address - end - end - - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_panko_apache_log.lua b/docker/heka/plugins/decoders/os_panko_apache_log.lua deleted file mode 100644 index 996f560f6..000000000 --- a/docker/heka/plugins/decoders/os_panko_apache_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - -- logger is either "panko-apache-public" or "panko-apache-admin" - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.panko' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end diff --git a/docker/heka/plugins/decoders/os_rabbitmq_log.lua b/docker/heka/plugins/decoders/os_rabbitmq_log.lua deleted file mode 100644 index 5ce6c65fc..000000000 --- a/docker/heka/plugins/decoders/os_rabbitmq_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015-2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -local dt = require "date_time" -local l = require 'lpeg' -l.locale(l) - -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = nil, -} - --- RabbitMQ message logs are formatted like this: --- =ERROR REPORT==== 2-Jan-2015::09:17:22 === --- Blabla --- Blabla --- -local message = l.Cg(patt.Message / utils.chomp, "Message") --- The token before 'REPORT' isn't standardized so it can be a valid severity --- level as 'INFO' or 'ERROR' but also 'CRASH' or 'SUPERVISOR'. -local severity = l.Cg(l.R"AZ"^1, "SeverityLabel") -local day = l.R"13" * l.R"09" + l.R"19" -local datetime = l.Cg(day, "day") * patt.dash * dt.date_mabbr * patt.dash * dt.date_fullyear * - "::" * dt.rfc3339_partial_time -local timestamp = l.Cg(l.Ct(datetime)/ dt.time_to_ns, "Timestamp") - -local grammar = l.Ct("=" * severity * " REPORT==== " * timestamp * " ===" * l.P'\n' * message) - -function process_message () - local log = read_message("Payload") - - local m = grammar:match(log) - if not m then - return -1 - end - - msg.Timestamp = m.Timestamp - msg.Payload = m.Message - msg.Logger = read_message("Logger") - - if utils.label_to_severity_map[m.SeverityLabel] then - msg.Severity = utils.label_to_severity_map[m.SeverityLabel] - elseif m.SeverityLabel == 'CRASH' then - msg.Severity = 2 -- CRITICAL - else - msg.Severity = 5 -- NOTICE - end - - msg.Fields = {} - msg.Fields.severity_label = utils.severity_to_label_map[msg.Severity] - msg.Fields.programname = 'rabbitmq' - - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_swift_log.lua b/docker/heka/plugins/decoders/os_swift_log.lua deleted file mode 100644 index 04aa6d20f..000000000 --- a/docker/heka/plugins/decoders/os_swift_log.lua +++ /dev/null @@ -1,49 +0,0 @@ --- Copyright 2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- The code in this file was inspired by Heka's rsyslog.lua decoder plugin. --- https://github.com/mozilla-services/heka/blob/master/sandbox/lua/decoders/rsyslog.lua - -local syslog = require "syslog" -local utils = require "os_utils" - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = read_config("hostname"), - Payload = nil, - Pid = nil, - Severity = nil, - Fields = nil -} - --- See https://git.openstack.org/cgit/openstack/swift/tree/swift/common/utils.py?id=2a8b455#n1423 -local swift_grammar = syslog.build_rsyslog_grammar('<%PRI%>%programname%: %msg%') - -function process_message () - local log = read_message("Payload") - - local fields = swift_grammar:match(log) - if not fields then return -1 end - - msg.Severity = fields.pri.severity - fields.syslogfacility = fields.pri.facility - fields.pri = nil - - msg.Payload = fields.msg - fields.msg = nil - - msg.Fields = fields - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_syslog.lua b/docker/heka/plugins/decoders/os_syslog.lua deleted file mode 100644 index 94e2744f8..000000000 --- a/docker/heka/plugins/decoders/os_syslog.lua +++ /dev/null @@ -1,55 +0,0 @@ --- Copyright 2016 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- The code in this file was inspired by Heka's rsyslog.lua decoder plugin. --- https://github.com/mozilla-services/heka/blob/master/sandbox/lua/decoders/rsyslog.lua - -local syslog = require "syslog" -local utils = require "os_utils" - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = read_config("hostname"), - Payload = nil, - Pid = nil, - Severity = nil, - Fields = nil -} - --- See https://tools.ietf.org/html/rfc3164 -local grammar = syslog.build_rsyslog_grammar('<%PRI%>%TIMESTAMP% %syslogtag% %msg%') - -function process_message () - local log = read_message("Payload") - local fields = grammar:match(log) - if not fields then return -1 end - - msg.Timestamp = fields.timestamp - fields.timestamp = nil - - msg.Severity = fields.pri.severity - fields.syslogfacility = fields.pri.facility - fields.pri = nil - - fields.programname = fields.syslogtag.programname - msg.Pid = fields.syslogtag.pid - fields.syslogtag = nil - - msg.Payload = fields.msg - fields.msg = nil - - msg.Fields = fields - return utils.safe_inject_message(msg) -end diff --git a/docker/heka/plugins/decoders/os_zaqar_apache_log.lua b/docker/heka/plugins/decoders/os_zaqar_apache_log.lua deleted file mode 100644 index fdaf40668..000000000 --- a/docker/heka/plugins/decoders/os_zaqar_apache_log.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2015 Mirantis, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local l = require 'lpeg' -l.locale(l) - -local common_log_format = require 'common_log_format' -local patt = require 'os_patterns' -local utils = require 'os_utils' - -local msg = { - Timestamp = nil, - Type = 'log', - Hostname = nil, - Payload = nil, - Pid = nil, - Fields = nil, - Severity = 6, -} - -local severity_label = utils.severity_to_label_map[msg.Severity] - -local apache_log_pattern = read_config("apache_log_pattern") or error( - "apache_log_pattern configuration must be specificed") -local apache_grammar = common_log_format.build_apache_grammar(apache_log_pattern) -local request_grammar = l.Ct(patt.http_request) - -function process_message () - - -- logger is either "zaqar-apache-public" or "zaqar-apache-admin" - local logger = read_message("Logger") - - local log = read_message("Payload") - - local m - - m = apache_grammar:match(log) - if m then - msg.Logger = 'openstack.zaqar' - msg.Payload = log - msg.Timestamp = m.time - - msg.Fields = {} - msg.Fields.http_status = m.status - msg.Fields.http_response_time = m.request_time.value / 1e6 -- us to sec - msg.Fields.programname = logger - msg.Fields.severity_label = severity_label - - local request = m.request - m = request_grammar:match(request) - if m then - msg.Fields.http_method = m.http_method - msg.Fields.http_url = m.http_url - msg.Fields.http_version = m.http_version - end - - return utils.safe_inject_message(msg) - end - - return -1, string.format("Failed to parse %s log: %s", logger, string.sub(log, 1, 64)) -end |
