{
    "name"  : "log保存检查",
    "problems" : {
        "log" : {
            "desc"      : "【问题】设备未将LOG保存到${0}",
            "advice"    : "【建议】未开启log日志记录，若将来出故障需要查看日志则查询不到历史记录。建议开启日志，并保存到flash，命令为：logging userinfo command-log\r\nlogging buffered 65535 \r\nlogging file flash:logging 2000000"
        },
		"log1" : {
            "desc"      : "【问题】设备未将LOG保存到${0}",
            "advice"    : "【建议】未开启log日志记录，若将来出故障需要查看日志则查询不到历史记录。建议开启日志，并保存到flash，命令为：logging userinfo command-log\r\nlogging buffered 65535 \r\nlogging file flash:logging 2000000\r\nlogging file sata0:syslog 2000000\r\nlogging file usb0:syslog  2000000"
        }
    }
}
---------------------------code-------------------------------
softVersion = get_device_softvesion()
mode = get_device_model()

res = cli("show run | in logging file flash")
res = res.split(/\r?\n/)

res1 = cli("show run | in logging file sata")
res1 = res1.split(/\r?\n/)

res2 = cli("show run | in logging file usb0")
res2 = res2.split(/\r?\n/)

print res.length + 'res1:' + res1.length + ' res2:' + res2.length
if res.length == 2 :
	if softVersion.indexOf("10.") != -1:
	if mode.indexOf("EG2000K/L") != -1 :
            add_problem("log",["U盘"])
            return "warn"
        else:
            add_problem("log",["flash"])
            return "warn"
        end
	end
end

if res.length == 2 && res1.length == 2 && res2.length == 2:
    if softVersion.indexOf("11.") != -1:
        if mode.indexOf("EG2000K/L") != -1 :
            add_problem("log1",["U盘"])
            return "warn"
        else :
            add_problem("log1",["硬盘"])
            return "warn"
        end 
    end
end

return 'success'
