Sha256: c901efcf6ca56a68963e3e7d5c32f1fc675748ee4e93dc3eb8b3b460cca66d53
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
-- 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' -- Allow custom type t = read_config('type') if t == nil or t == '' then t = 'log' end local msg = { Timestamp = nil, Type = t, 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-g5k-0.0.16 | results/files/heka/lua_decoders/os_mysql_log.lua |