function add_log_source(tag, timestamp, record) local source = record["source_file"] if source ~= nil then -- Get filename from full path local filename = string.match(source, "([^/]+)$") if filename ~= nil then if string.match(source, "^/usr/local/cpanel/logs/") then record["log_source"] = "cpanel." .. filename elseif string.match(source, "^/var/log/apache2/") then record["log_source"] = "apache." .. filename elseif string.match(source, "^/var/log/audit/") then record["log_source"] = "audit." .. filename elseif string.match(source, "^/var/log/") then record["log_source"] = "system." .. filename else record["log_source"] = filename end end end return 2, timestamp, record end