面向主动运维的Syslog日志分析方法
2017-11-08叶成刚
叶成刚
摘要:网络在运行过程中,有时会出现一些异常事件,这些异常事件对网络具有一定的危害性,严重的可能会导致网络故障。现代网络运维工作中普遍使用Syslog日志记录网络设备上发生的各种事件,然而许多网络运维部门仅仅用Syslog日志分析故障,对日志中所反映的网络异常情况往往重视不够。为了改变被动等待故障的工作方式,网络部门需要全面了解网络的运行情况,找出可能导致网络故障的因素,使得运维工作由被动变为主动。Syslog日志分析是主动运维工作中的一项重要内容。由于大型网络中Syslog日志数量非常庞大,依靠人的分析方法几乎不可行,而且由于日志消息格式的随意性,也使得传统的基于规则的计算机分析方法通用性较差。本文通过对异常事件的特征进行研究,结合实际网络中的Syslog日志数据,对如何找出网络中的异常事件和异常设备进行总结。
关键词: 日志; 异常事件; 主动运维; 日志分析
中图分类号: TP393.08
文献标志码: A
文章编号: 2095-2163(2017)05-0050-06
Abstract:Sometimes, the abnormal events may be happened in a running network. The abnormal events are harmful to the network and even lead to network failure. Syslog is widely used in modern network to record events happened with devices. But in many networks, Syslogs are analysed just after network failure and the abnormal events hidden in Syslogs are ignored. In order to change the passive work mode of waiting for network failure, the network department needs to fully understand the health of the network and identify the factors that may lead to network failure. Syslog analysis is an important part of active maintenance work. While it is almost impossible for the people to analyse Syslogs of large scale network because of huge numbers of Syslogs. Also the rule based analysis method for computers is not suitable for other networks due to the arbitrariness of Syslog formats. In this paper, the characteristics of the abnormal events are researched and the Syslog analysis method to find the abnormal events and devices is introduced.
Keywords: Syslog; abnormal event; active operation and maintenance; Syslog analysis
0引言
随着互联网技术的飞速发展和移动应用的推广普及,人们的日常生活与工作已与网络建立了密切联系。确保网络的可用性与稳定性成为了网络运维部门的重要目标。在传统运维模式下,运维部门被动响应和处理网络故障,工作效率低下。而在主动运维模式下,運维人员需要采取各种主动措施,找出网络中存在的问题。在实际网络运维中,通常会使用Syslog日志记录网络运行过程中设备上发生的事件,所有设备的日志信息将会发送到Syslog服务器集中存储。Syslog日志在网络运维中具有较高的分析价值和用途,不仅可以用于故障分析,还能用于发现网络异常情况、网络安全威胁、用户行为分析等诸多方面。本次研究则立足于综述大型网络的主动运维工作要求下,如何通过Syslog日志找出网络中的异常设备,并以实际运维网络的Syslog日志数据进行分析验证。
1Syslog介绍
1.1Syslog协议
Syslog协议最早由美国加州伯克利大学研究开发,由于其在运维管理方面呈现重要价值,因此在许多操作系统和网络设备中都选择内嵌了该协议。在一个最简单的Syslog协议模型中,由生成日志的发送器和接收日志的收集器两部分组成,发送器可以称为设备,收集器也可称为Syslog服务器。Syslog使用UDP传输协议,源和目标端口通常为514。
1.2Syslog消息结构
完整的Syslog日志格式由优先级(Priority)、消息头(Header)、消息文本(Content)三部分组成。一个典型的Syslog消息格式如下:
<34>Oct 1 22:33:15 myhost su: 'su root' failed for admin on /dev/pts/8
优先级通常由字符“<”开始,后面是1~3位的数字,然后以“>”结尾。其中的数字部分由日志的程序模块(Facility)代码和消息的严重级别(Severity)编号计算得出。优先级的数值等于程序模块代码乘以8,再加上严重级别编号。endprint