Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

The design and implement of the centralized log gathering and analysis system

Jian-hua Huang, Man-qi Zhang, Yuan-long Jiang


School of Information Science and Engineering
East China University of Science and Technology
Shanghai, China
jhhuang@ecust.edu.cn, yzszmq@163.com, jyl7-2@163.com

Abstract-Logs generated by network devices and systems SHERNET has been transformed several times, the number,
provide important information for network management. In species and complexity of the network devices are
this paper, we describe a centralized syslog system which increasing sharply. In order to find out the network
gathers and analyzes log messages from a number of routers, anomalies and security threats, it is necessary to view all the
switches and firewalls. The gathered logs are filtered and log messages generated every day by active networking
categorized with regular expression, and finally stored in a devices. It is out of human capabilities. So we should use
MySQL database with format. Through the statistics analysis, some special software tools which help us to skip over
feature-based detection on security events, the system can mostly daily event messages to find out the network
effectively find out abnormal behavior of network devices and anomalies and security threats effectively and accurately.
ensure the network security. Some methods are found out to As the complexity and diversity of the network devices,
allow us to check if the network behavior is unusual. These a standard network protocol named syslog is applied to
perspective methods also provide the basis of network gather log messages from firewalls, routers, switches and
management and security strategy design for administrators, other network devices. For the purpose of solving problems
thereby strengthen further network management. in practice, a syslog system which can gather, analyze and
store log messages is designed. Network devices in
Keywords-router; firewall; syslog; regular expression
SHERNET can send their log messages to the centralized
I. INTRODUCTION syslog server which filters raw logs and stores parsed results.
By collecting and extracting useful information, the
With the continuous and rapid development of the
administrators can keep abreast of the network status and
computer networks and network applications, the security
solve security issues timely.
issues need more special attention. In order to safeguard the
The rest of the paper is organized as follows. Section II
network security, people tend to adopt quite a lot measures.
discusses related works on syslog. Section III presents an
Among them, the log messages which record various system
overview of our system. Section IV gives implementation of
events occurred every day in the network devices, play an
the system. Section V gives statistical analysis techniques to
important role in network security management.
logs. Section VI concludes with a discussion of the results.
Shanghai education and research network (SHERNET)
is a large metropolitan computer network, which connects II. RELATED WORKS
all the universities in Shanghai. The backbone nodes which
A. Syslog Protocol
composed a ring topology are connected by 10 NE40E
The syslog protocol was introduced by the Computer
routers. Each node site consists of a large number of routers,
Science Research Group (CSRG) at the University of
switches, firewalls, and application servers. Since the
___________________________________
978-1-4673-0089-6/12/$26.00 ©2012 IEEE


California-Berkeley as part of the Berkeley Software modeling of errors and failure prediction based on the
Distribution of UNIX. Syslog was designed to provide the models. Gu Zhaojun [3] implemented a log analysis system
ability to report system events. These events are collected by which gathered and pretreated syslog logs generated by PIX
a process and then recorded in log files on the local system, firewall, then carried on the TopN statistical analysis and
a remote system or both. Administrators can view the log detected security events for realizing the effective
files, which can help them to keep track of system status and surveillance on the network behavior. Karel Slavicek [4]
ensure the normal operation of systems. It is very common described mathematical methods that are trying to be used
for switches, routers, firewalls, and other devices to be for syslog message processing. The goal was to find out
configured to log data via the syslog protocol [1]. some mathematical description of network behavior which
Syslog adopts the user datagram protocol (UDP) as its would allow us to check if the network behavior is usual or
underlying transport layer mechanism. The format of a if it needs some special attention. Cisco IOS also provides a
syslog message which is defined in RFC3164 has three programmable framework that allows us to filter, correlate
discernable parts. The first part is called the PRI, the second and customize system log messages prior to delivery to a
part is the HEADER, and the third part is the MSG. They are syslog server [5]. The disadvantage of this approach is its
showed as follows: high demand for manual programming work.
<priority>timestamp hostname tag: content The important event messages are sometimes hidden in a
First is PRI (<priority>). The logs collected via syslog large number of relatively less important and usual event
describe activity and conditions monitored by diverse audit messages. Some research has been devoted to find out
components which are categorized as facilities in syslog anomalies accurately and quickly by using data mining of
parlance. An audit component supplies a rating of its log message. Justin Myers [6] presented a distributed event
severity. The priority of a log is defined as the pairing of the correlation system which performs security event detection,
corresponding facility and severity: and evaluates it experimentally, compared with a centralized
Priority=facility*8+severity (facility and severity adopt alternative. The comparison measures the value in
the decimal digit code) distributed event correlation by considering network
The HEADER includes timestamp and hostname. The bandwidth utilization, detection capability and database
timestamp field is the local time and is in the format of query efficiency. Fukuda [7] presented a method to construct
"Mmm dd hh:mm:ss". The hostname field contains only the the log time series for anomaly detection in order to
hostname, the IP address of the originator of the message. highlight such hidden anomalies, his work focused on the
The MSG consists of tag and content. The value of the effectiveness of using a global weight that is based on a
tag is the name of the program or process that generated the global appearance of a message type in the all data set.
message. The content contains the details of the message. Although many analysis tools have been developed to
find unusual events in a network, the analysis is expensive
B. Related Studies
and difficult. The reasons for this include the sheer volume
The potential utility of log analysis for security event
of data to collect, process and store, the difficulty of doing
detection is clear. A report on data breaches investigated by
the actual analysis, the difficulty of effectively reporting the
the Verizon Corp Business Risk Team reported in 2008 that
results. In this paper, we present an effective system for
66% of organizations investigated had sufficient evidence
collecting, categorizing, storing, and analyzing syslog
available within their logs to discover the breach had they
messages. Some methods which accurately find out
been more diligent in analyzing such resources [2].
anomalies in SHERNET are discussed.
The studies of system logs to characterize system and
network behavior have been a focus of research for some III. ARCHITECTURE OF THE SYSTEM
time. Early work on the study of logs focused on statistical


A. SHERNET system parts. The received syslog messages will be
SHERNET is a large metropolitan computer network, pretreated, sent to the real-time alarm module, and stored
which connects all the universities in Shanghai. The into the database, in this way we can do further analysis.
backbone nodes which composed a ring topology are made Logs gathered from SHERNET include basic
of 10 NE40E routers. Figure 1 depicts the ring topology of information of IP layer’s dataflow, many of them are
SHERNET. redundant. Therefore, prior to storing them into the database,
the system needs to analyze them and extract the useful field,
SHU SHUFE
which helps to enhance the efficiency of the system and

ECNU FDU
avoid resources wasting as well.
2) Real-time Alarm
In the centralized log gathering and analysis system, in
DHU TJU
addition to the syslog messages that are stored into the
database for further analysis after pretreatment, the real-time
CERNET
running status of the network should be monitored. In order
SJTU SHSMU to discover the heritage of network and activities which

CERNET2
violate security policies, real-time alarms are essential.
3NET
SHNAP
SHMU Real-time alarms are triggered by the real-time alarm
module according to a certain alarm strategy, which consists
Figure 1. The ring topology of SHERNET
of several alarm rules laid down in advance. It can report the
B. Architecture of the System exception of SHERNET to the monitoring center promptly

Our system is designed for gathering logs from routers, to take further measures.

switches, firewalls and some other devices in SHERNET. 3) Database

The system consists of 5 parts: log generators, log receiver, Although the gathered logs had been pretreated, the

database, real-time alarm, and statistical analysis. Its amount is still quite huge. In order to respond rapidly to the

architecture is shown in Figure 2. system when analyzing and processing data from the
database, MySQL is chosen as the log database. The core
Device Real-time thread of MySQL is completely multi-threading, which
Alarm might accelerate the speed of the system. MySQL supports
Device
C++ and many other programming languages, and open
Syslog Statistical


Database database connectivity (ODBC) as well.


Receiver Analysis
Device 4) Statistical Analysis
After collection, pretreatment and storage of log
Figure 2. The architecture of the system
messages is done, we can analyze and audit logs in the
C. Log Generators database next. Due to the amount of logs is quite huge, the
system sets up a log query function, which is user-friendly.
Log generators are devices generated logs. These devices
The TopN statistics analysis and feature-based detection on
are routers, switches, firewalls and some other devices in
security events are carried out.
SHERNET. They report their own events to the syslog
receiver. IV. IMPLEMENT OF THE SYSTEM
1) Syslog Receiver
The centralized log gathering and analysis system was
Network devices in SHERNET send their log messages
designed for gathering logs from routers, switches, firewalls,
to port 514 of the syslog receiver which is the core of all


and some other devices in SHERNET. The whole system The syslog format of Cisco routers is as follows:
was developed by C++ language, included five modules <189>931: *Sep 11
which are the log generators, the log receiver, the database, 20:07:26: %LINEPROTO-5-UPDOWN: Line protocol on
real-time alarm, and statistical analysis engine. To Interface FastEthernet0/2, changed state to down
effectively monitor the running status of the network, the Log parsing technology is a light spot of the system; we
system gathered, pretreated syslog logs, sent them to adopt a two-layer analysis approach to provide a simple
real-time alarm for examining security event, stored them interface to separate syslog messages for devices from
with format in MySQL, then carried on statistical analysis different manufacturers. Regular expressions are adopted to
and, finally displayed the results with kinds of formats, so conduct the two-layer analysis. In the first layer analysis,
the administrators can manage easily the network and regular expressions are used to separate log messages into
institute the security policy. log fields which are saved into the database for statistical
analysis and depth data mining. A rule library which
A. Thread Pool and Database Connection Pool
includes regular expressions to analyze the logs of devices
The thread pool technology provides a sound solution for
from different manufacturers is used to the second layer
both the problem of thread life-cycle overhead and the
analysis. The rule library consists of the rules which are used
problem of resource insufficiency. Thread pool is a form of
to find out system abnormalities. Log fields from the first
multi-threaded processing, tasks to be processed will be
layer analysis will be submitted to the real-time alarm
added to the queue, and then the thread is created to execute
module for the second layer analysis, from which network
these tasks automatically. Thread pool is particularly
anomalies and potential attacks can be found out through
suitable for implementing tasks that require multiple threads,
matching with the rules in the rule library.
which can eliminate the delay generated by creating the
In computing, a regular expression (RE) provides a
thread. After applying the thread pool technology, the log
concise and flexible means to match strings of text, such as
receiver engine becomes more responsive and its
particular characters, words, or patterns of characters. The
performance gets greatly improved.
concept of regular expressions was first popularized by
In the process of the program accessing to the database, a
utilities provided by Unix distributions, in particular the
connection with the database should be established firstly,
editor ed and the filter grep. A regular expression is written
however, the time of establishing database connection is far
in a formal language that can be interpreted by a regular
more than data handling. In order to avoid consuming time,
expression processor, which is a program that either serves
our system adopts the database connection pool technique,
as a parser generator or examines text and identifies parts
which can connect and disconnect the database rapidly. The
that match the provided specification.
database can be shared by different clients; thereby the
The following are ARP alarm logs generated by a
efficiency of data handling and the server performance are
SepiaNIPS firewall, which show that the firewall found a
improved.
new device and recorded its IP address and MAC address
B. Log Parsing and some other information.
The syslog protocol is quite simple, detailed provisions Mar 17 13:20:59 SepiaNIPS alert:
are not given in the protocol. Each manufacturer has its own mac=00:11:92:76:e8:40, ip=192.168.2.2, type=new
structure of HEADER and MSG parts. The following is an Mar 17 13:22:29 SepiaNIPS alert:
example of the syslog format from a HuaWei NE40E router. mac=00:11:92:76:e8:40, ip=192.168.2.3, type=ipchange
<189>Jun 7 05:22:03 2011 Quidway Mar 17 13:26:18 SepiaNIPS alert:
IFNET/6/UPDOWN: Line protocol on interface mac=00:11:92:76:e8:40, ip=192.168.2.2, type=new
Ethernet0/0/0, changed state to UP We use regular expressions to analyze the above syslog


messages. The following regular expressions are written columnar, caky and curve tendency chart. According to the
according to ARP alarm logs: statistical analysis information, the administrators may judge
1> %timereported:::date% whether some abnormal events exist, thereby revise the
2> %hostname% device rules in time.
3> %syslogfacility-text% TopN sort is a course which selects the highest N
4> %msg:R,ERE,1,BLANK,0:mac=([0-9a-f\ :]+)—end elements of a certain standard. Some useful information can
5> %msg:R,ERE,1,BLANK,0:ip=([0-9\ .]+)--end% be gathered from the database to obtain the TopN statistics,
6> %msg:R,ERE,1,BLANK,0:type=([a-z]+)--end% which mainly included SRC_IP, DST_IP, traffic and so on.
The fields of MSG, port and some others obtained
A. SRC_IP
through the first layer analysis are main input messages of
Source IP statistics can help managers discover the most
the second layer analysis, which contains detailed
traffic host in the network. However, when a host’s traffic is
information of logs, such as specific intrusion methods, user
far more traffic than others, this host may be attacked, or be
name and some other information.
attacking, or download something by BT. Figure 3 shows
Two log types and corresponding regular expressions are
the users’ traffic in the network.
illustrated as follows:
1) System Maintain
*matching logs of successful login into a device
Successful\\s*([A-Z]+)\\s*login
* matching logs of failed login into a device
([A-Z]+)\\s*login\\s*failed
2) Attack
* IP spoofing Attack
ip\\s*spoofing\\s*-\\s*WAN\\s*((?:TCP)|(?:UDP)|(?:IG
MP)|(?:ESP)|(?:GRE)|(?:OSPF))
Figure 3. Source IP counts
ip\\s*spoofing\\s*-\\s*
WAN\\s*ICMP)\\s*\\(type:(\\d+),\\s*code:(\\d+)\\ B. DST_IP
ip\\s*spoofing\\s*-\\s*no\\*routing\\s*entry\\s*ICMP)\\s Destination IP reflects the most popular host in the
*\\(type:(\\d+),\\s*code:(\\d+)\\ network. According to the times of the accessed Destination
ip\\s*spoofing\\s*-\\s*WAN\\s*((?:TCP)|(?:UDP)|(?:IG IP, the system carried on the Top10 statistics. The
MP)|(?:ESP)|(?:GRE)|(?:OSPF)) proportion of destination IP is displayed in figure 4.
V. LOG ANALYSIS
Administrators can get a lot of useful information from
the gathered syslog messages. For example, we can find out
which application is error and whether the device is
subjected to the invasion. According to the log data from the
database, some import and useful information was made the
TopN statistics and analyzed security event, which mainly
included facility, severity, source IP, destination IP, protocol,
destination port, traffic and so on, then the system attained
results and displayed them via the table, the linearity, Figure 4. Destination IP counts


We adopt pattern analysis for parsing the syslog The syslog messages from all network devices are
messages of known structure. Regular expression is used to gathered together in a database. The statistical analysis
search the syslog messages for known pattern of an event. engine can find out a lot of unusual events to support daily
For example, the default service port of Microsoft SQL maintenance of SHERNET.
Server is 1433. If a firewall records a lot of tests aiming at
VI. CONCLUSION
port 1433, there may be password attacks on a SQL Server.
The following log shows that a host addressed 172.20.45.81 Log messages play an important role in network security
is trying the password of the SQL Server addressed management. The main contribution of this paper is to
202.120.107.179: present a solution for gathering, storing and analyzing a
<3>Nov 16 23:44:01 SepiaNIPS kernel: large amount of log messages from different devices. An
DROP_DS_AntiDDoS:IN=br0 OUT=br0 PHYSIN=eth1 approach which uses regular expressions for parsing log
PHYSOUT=eth0 SRC=172.20.45.81 DST=202.120.107.179 messages and matching network anomalies is proposed. We
LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=14685 DF have implemented a centralized log gathering and analysis
PROTO=TCP SPT=45120 DPT=1433 WINDOW=14600 system which is used to detect network anomalies, carry on
RES=0x00 SYN URGP=0 the statistical analysis, and ensure the network security. Our
Compared with analyzing device’s log message one by future works will include the following 2 aspects:
one, a centralized log analysis allows aggregation of Large quantities of log messages are gathered to the
messages reporting the same event and summation of syslog server. The system will inevitably need larger storage
repeating messages. For example if there is physical line space. On the aspect of processing the massive logs, it needs
break on line connecting two backbone routers, maybe we further study on how to raise its efficiency and accuracy.
receive three messages from each router. These messages Log messages gathered to the syslog server contains
are “link down”, “line protocol down”, “routing protocol large quantity of information. We should provide the
down”. These six messages report one link interruption network a massive information processing platform based on
event. The following log shows that line protocol go down the high performance data mining. Via association rules
on a router. analysis, we can also find out the users’ habits and conduct
<189>Dec 3 09:33:12 2011 Quidway further improvement.
IFNET/6/UPDOWN: Line protocol on interface REFERENCES
Ethernet0/0/0, changed state to DOWN [1] FC3164: The BSD Syslog Protocol[S]. 2001.08.
When the line is restored the syslog server will receive [2] Baker, Wade, A. Hutton, C. D. Hylender, C. Novak, C. Porter, Bryan
Sartin, Peter Tippett, and J. A. Valentine. Data Breach Investigations
six new messages reporting that the line, line protocol and Report. Technical report, Verizon Business RISK Team, 2009.
routing protocol went up on both ends of the line. Figure 5 [3] Gu Zhaojun, Li Yong, Niu Wenjing, China Tianjin. Analysis and
implement of PIX firewall syslog log[C]. Information Management
shows the line breaks of SHERNET on a whole day. and Engineering (ICIME), 2010 The 2nd IEEE International
Conference, Chengdu, 16-18 April 2010.
[4] Slavicek, K.; Ledvinka, J.; Javornik, M.; Dostal, O. Mathematical
Processing of Syslog Messages from Routers and
Switches[C] .Information and Automation for Sustainability(ICIAFS
2008). 4th International Conference,2008, Page(s): 463-468.
[5] Anand Deveriya. An Overview of the syslog Protocol[M]. Cisco
Press, 2005.
[6] J. Myers, M. R. Grimaila, and R. F. Mills. Log-Based Distributed
Security Event Detection Using Simple Event Correlator[C]. System
Sciences (HICSS), 2011 44th Hawaii International Conference,
Date:4-7 Jan. 2011.
[7] K. Fukuda. On the use of weighted syslog time series for anomaly
detection[C]. Integrated Network Management (IM), 2011 IFIP/IEEE
International Symposium, Date:23-27 May 2011.
Figure 5. The line breaks between nodes of SHERNET



You might also like