function map_facility_severity(tag, timestamp, record)
    local priority = record["priority"] or record["pri"]
    
    if not priority then
        record["facility"] = "user"
        record["severity"] = "info"
        return 2, timestamp, record
    end
    
    local facility_map = {
        [0] = "kern", [1] = "user", [2] = "mail", [3] = "daemon",
        [4] = "auth", [5] = "syslog", [6] = "lpr", [7] = "news",
        [8] = "uucp", [9] = "cron", [10] = "authpriv", [11] = "ftp",
        [16] = "local0", [17] = "local1", [18] = "local2", [19] = "local3",
        [20] = "local4", [21] = "local5", [22] = "local6", [23] = "local7"
    }
    
    local severity_map = {
        [0] = "emerg", [1] = "alert", [2] = "crit", [3] = "err",
        [4] = "warn", [5] = "notice", [6] = "info", [7] = "debug"
    }
    
    local facility_num = math.floor(priority / 8)
    local severity_num = priority % 8
    
    record["facility"] = facility_map[facility_num] or "user"
    record["severity"] = severity_map[severity_num] or "info"
    
    return 2, timestamp, record
end
