-
Notifications
You must be signed in to change notification settings - Fork 2
Parsing user logs
WojciechRynczuk edited this page Aug 29, 2017
·
9 revisions
The application shall allow for parsing user logs. The format of the log will be provided by a user created XML file.
The application shall accept additional option: -u <log_format_file>
The configuration is passed by the first parameter of the source description. The user format shall be passed by the ‘U’ option as follows:: U{<log_format_file>}.
The expected XML configuration structure has been described below.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE signals SYSTEM "vcdMaker.dtd">
<signals>
<vector>
<line> Regular expression describing the line including group matching </line>
<timestamp> E.g. ‘\1’ or’ 60*\1 + \2’ (for min:sec format) or ‘hex2dec(\1) ‘</timestamp>
<name> Fixed full name or group matching name, e.g. ’\3.Value’</name>
<value>The value of the signal. The regex group.</value>
<size>The size of the vector.</size>
</vector>
<real>
<line> Regular expression describing the line including group matching </line>
<timestamp> E.g. ‘\1’ or’ 60*\1 + \2’ (for min:sec format) or ‘hex2dec(\1) ‘</timestamp>
<name> Fixed full name or group matching name, e.g. ’\3.Value’</name>
<value>The value of the signal. The regex group.</value>
</real>
<event>
<line> Regular expression describing the line including group matching </line>
<timestamp> E.g. ‘\1’ or’ 60*\1 + \2’ (for min:sec format) or ‘hex2dec(\1) ‘</timestamp>
<name> Fixed full name or group matching name, e.g. ’\3.Value’</name>
</event>
…
</signals>
</log_configuration >
There might exist several vector, real or event nodes. According to the user needs. The syntax of the XML file can be verified with the provided DTD file:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT signals (vector | real | event)*>
<!ELEMENT vector ( line,
timestamp,
name,
value,
size)
>
<!ELEMENT real ( line,
timestamp,
name,
value)
>
<!ELEMENT event ( line,
timestamp,
name)
>
<!ELEMENT line (#PCDATA)>
<!ELEMENT timestamp (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT value (#PCDATA)>
<!ELEMENT size (#PCDATA)>
To parse the original vcdMaker format one could use the configuration file below:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE signals SYSTEM "vcdMaker.dtd">
<signals>
<vector>
<line>^#([[:d:]]+) ([[:graph:]]+) ([[:d:]]+) ([[:d:]]+)( +.*)?</line>
<timestamp>1</timestamp>
<name>2</name>
<value>3</value>
<size>4</size>
</vector>
<real>
<line>^#([[:d:]]+) ([[:graph:]]+) ([[:d:][:punct:]]+) f( +.*)?</line>
<timestamp>1</timestamp>
<name>2</name>
<value>3</value>
</real>
<event>
<line>^#([[:d:]]+) ([[:graph:]]+) e( +.*)?</line>
<timestamp>1</timestamp>
<name>2</name>
</event>
</signals >