Using log files
Since version 0.6.5, impulse supports presentation of log files together with transactions, analogue and digital signals (if wanted ). With 0.6.7 there are now readers available for pattern based logs (e.g. log4j pattern writer) and log4j xml format. This article shows how to set-up the reader for a given format and how to analyse the log content.
Make sure you installed the log serializers.
2 Prepare the reader
There is currently a reader for the log4j xml format and for pattern formats. The xml reader needs no configuration, a double-click on the file does it. For the pattern log reader you need to define a configuration.
2.1 Prepare the pattern log reader
- Goto Preferences -> Impulse -> Serializers
- Select the "Pattern log" serializer -> Edit
The preferences dialogue of the pattern log reader pops up.
- Press "Add" to create a new configuration, select "Pattern Log Configuration".
The configuration dialogue of the pattern log reader pops up.
- Set a meaningful name.
- Select char set and time base.
- The "Match pattern" settings define one of your pattern as the one used to match with a given file. If the given pattern matches the first line of the file, the configuration is used to read the file.
- Press "Add" to create a new pattern, select "Log Pattern".
You can define multiple pattern (e.g. you may have different log styles from different units). When reading, it takes the first pattern that matches. Use the buttons on the right side to re-order your patterns.
The configuration dialogue of the log pattern pops up.
- Set a meaningful name.
- Add a few lines of your log file into the field "Test Lines".
- Define the regular expression for the lines. Use the context proposals (press control-space). For more information about java regular expressions see http://docs.oracle.com/javase/tutorial/essential/regex/
- Press "Test" to validate the expression.
First step is done. Now you need to define what to do with the extracted attributes.
- Select the action.
- Ignore : Just skip the line
- Create new log event
- Append to previous: The information will be added to the previous event (e.g. from previous line).
- Select the attribute names. You can select a predefined name or enter a new one.
- Since 0.8.2 the attributes can have a type (e.g Name<Float> or Name<Integer>). Default type is Text.
- Define the time-stamp:
- Date: you need to define the date format. Use content proposals and http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html.
- Float execution time: Parse a float value, optionally let it to parse the time unit from the file or assign a unit.
- Integer execution time: Parse an integer value, optionally let it to parse the time unit from the file or assign a unit.
- Define the naming:
- Default name : All log events get into one signal with the name "log".
- Name from attribute : The given attribute is taken to define the signal name. The logs events will be stored into different signals.
- Hierarchy from attribute : Similar to the previous one. The difference is that the attribute is split up (hierarchy separator) and the signal is embedded into a hierarchy of logs.
Now you are ready with the reader configuration. Please have in mind that the standard file extension for pattern logs is ".log". To change ,please use the Preferences -> General -> Content Types -> (Element/Record/Pattern Log Record).
3 Analyse the logs
- Double-click the file to open the viewer.
- Create a new viewer configuration ( this configuration defines how to see the log content).
- Use the cursor to move around.
- Use the manual to find out what can be done with impulse.
The viewer allows to view the log events along the time axis. To get more general information about the log signals or to see the logs in a table:
- Get to Windows -> Show View -> Impulse -> Value Table/ Signal Table and select
- Select multiple event signals to watch.
Instead of using files, you may stream the log
- from a pipe,
- a socket,
- from the output of a process,
- or define a combination of multiple files (resources).
- To do so, get to Windows -> Show View -> Impulse -> Signal Ports and select