-
Notifications
You must be signed in to change notification settings - Fork 2
Parsing user logs
WojciechRynczuk edited this page Aug 6, 2018
·
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> Timestamp expression </timestamp>
<name> Name expression </name>
<value> Integer value expression </value>
<size> Size expression </size>
</vector>
<real>
<line> Regular expression describing the line including group matching </line>
<timestamp> Timestamp expression </timestamp>
<name> Name expression </name>
<value> Float value expression </value>
</real>
<event>
<line> Regular expression describing the line including group matching </line>
<timestamp> Timestamp expression </timestamp>
<name> Name expression </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>dec(1)</timestamp>
<name>txt(2)</name>
<value>dec(3)</value>
<size>dec(4)</size>
</vector>
<real>
<line>#([[:d:]]+) ([[:graph:]]+) ([[:d:][:punct:]]+) f( +.*)?</line>
<timestamp>dec(1)</timestamp>
<name>txt(2)</name>
<value>flt(3)</value>
</real>
<event>
<line>#([[:d:]]+) ([[:graph:]]+) e( +.*)?</line>
<timestamp>dec(1)</timestamp>
<name>txt(2)</name>
</event>
</signals >