• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Data Logging
  • ValueLogReader
  • 5.0.0

EventLogReader LogWriter

ValueLogReader

Introduction

A Sequencer block for reading data from CDP Logger or LogServer and exposing it as a message-based API.

Usage

To set up a ValueLogReader, add it to the configuration and connect it to a CDP Logger or LogServer by setting the ServerAddress and ServerPort properties.

When extracting data, it is recommended to first call ReqDefinitions to get a list of all logged nodes with their tags and then call ReqData to read the actual data.

The following is a block diagram of the typical usage of the ValueLogReader block. See below for instructions on how to replicate the example.

Tips

  • Combine the ValueLogReader with RangeScanner and LogWriter to extract a part of the log to a new Datastore.
  • The logs can be quite large, so it is recommended to use the Limit property to read data in batches.
  • Disable the IncludeInitialValues property to prevent repeating values at batch borders when extracting data in batches (meaning the RangeEnd emitted with the last ReqDataDone is the RangeStart of the next ReqData). Otherwise, the first row of each batch always contains the initial value of every node.

Configuration

See below for a list of configuration options specific to this block.

Message Events

NameTypeDescription
InitInputClears any internal buffers and connects or reconnects to the log server. It is mandatory to call this when the WaitForInit property is true. Will emit Inited when done.
InitedOutputWill be emitted after Init is done meaning the logger connection is up and the block is ready to serve requests. Note when the WaitForInit property is false, the block will automatically connect at startup and emit Inited.
ReqBoundsInputRequests the available history range (i.e. timestamp of the first and last logged sample). Will emit either ReqBoundsDone or Error when done.
ReqBoundsDoneOutputEmits the timestamps of the first and last sample in the datastore as RangeStart and RangeEnd.
ReqDefinitionsInputRequests a list of all logged nodes. Will emit ReqDefDone or Error when done.
DefinitionOutputDefinition of a single logged value. For each logged value, emits its LoggedName, Path, Tags and TagSources (if available).
ReqDefDoneOutputEmitted once all Definition messages are sent.
ReqDataInputRequests data between RangeStart and RangeEnd with the specified Limit for batch size and includes nodes allowed by the PathFilter. When Resolution is non-zero, low-resolution compacted data is returned. Will emit ReqDataDone or Error when done.
DataOutputA single value change. For each cell (row and column) in ReqData response, emits its Timestamp, Value, LoggedName, Path, ValueType, ValueMin, ValueMax, Tags and TagSources (if available).
ReqDataDoneOutputEmitted once all Data messages are sent. Includes RangeStart (timestamp of the first Data message) and RangeEnd (timestamp of the last Data message). In case no data was found, RangeStart is the same as the input to ReqData and RangeEnd is capped at the log range end.
ErrorOutputFailure when requesting data described by ErrorMsg.

Reading Tags

When reading data, the associated tags can be accessed in two ways:

  • Parse the semicolon-separated list in the Tags argument.
  • Add each tag as a separate output argument with the tag name as the argument name. In that case, the tag value will be set to the argument value. Note each user-added argument must be listed in the Data property of the message event.

This affects the Definition and Data messages.

Arguments

NameTypeDescription
ServerAddressInputIP address (e.g. 127.0.0.1) or NetworkInterface Name (defined under application node, e.g. ETH0) of the CDP Logger's built-in server or LogServer.
ServerPortInputPort of the CDP Logger's built-in server or LogServer.
RangeStartInputStart timestamp for log reading (inclusive). When used as input to ReqData, leave it empty to read values from the beginning of the log. The unit is specified by the TimeUnit property.
RangeEndInputEnd timestamp for log reading (inclusive). When used as input to ReqData, leave it empty to read values until the end of the log. The unit is specified by the TimeUnit property.
ResolutionInputThe sampling rate (Hz) for the data to read. Use this to limit the data resolution or set it to 0 for full resolution.
PathFilterInputSemicolon-separated list of node paths to read. See the FilterMode property for wildcard and regex support. Leave empty to read all logged nodes.
LimitInputMaximum batch size (the number of samples). Reading in large batches will improve performance but also allocate more memory. When combined with RangeScanner, the Limit must be at least two times the number of logged nodes, so each node would get the initial value and one extra sample.
TimestampOutputUnix timestamp of a value change. The unit is specified by the TimeUnit property.
ValueOutputThe value change of a single node. For low-resolution data, this is the last value in the time span.
ValueMinOutputThe minimum value in a time span when requesting low-resolution data.
ValueMaxOutputThe maximum value in a time span when requesting low-resolution data.
ValueTypeOutputThe value type of a value change. Valid values are "undefined", "double", "uint64_t", "int64_t", "float", "unsigned int", "int", "unsigned short", "short", "unsigned char", "char", "bool" and "string".
LoggedNameOutputA friendly name to a logged node (defined in the CDPLogger's LoggedValues table Name column). Guaranteed to be unique within a logger instance.
PathOutputThe path (full Routing) to a node that emitted the value change.
TagsOutputSemicolon-separated tagname=value list of all tags associated with a logged node.
TagSourcesOutputA semicolon-separated tagname=source list that describes the path where the Tags information was fetched from. Note: for CDPLogger, the tag source is only available when found using TagLookup rules, not entered manually by the user under LoggedValues.
ErrorMsgOutputThe error message emitted when a request fails.

Properties

NameDescription
DebugThe debug level. Increase it to see more printouts.
FilterModeAffects the PathFilter argument behavior. Note, the ExactMatch means the full path must match, use Wildcard or Regex for partial match support.
IncludeInitialValuesDisable to prevent repeating values at batch borders when extracting data in batches (meaning the RangeEnd emitted with the last ReqDataDone is the RangeStart of the next ReqData). Otherwise, the first row of each batch always contains the initial value of every node.
TimeUnitUnit of the Timestamp argument. Can be set to Second, Millisecond, Microsecond or Nanosecond since epoch (Unix timestamp). Affects Timestamp, RangeStart, and RangeEnd.

Example

Here is a minimal example using the ValueLogReader. The example ValueLogReader connects to a CDP Logger logging a CPULoad signal and extracts all logged values to a CSV file in small batches and keeps extracting as new values are logged.

To run the example, start the application and trigger manually the ValueLogReader's ReqDefinitions message. The extracted values will be written to a "log.csv" file in the application's working directory.

Here is how to replicate the example:

  • Create a system.
  • From the Resource tree, add
    • CDPLogger.CDPLogger - the built-in logger component which by default logs values to CDPCompactDatastore.
    • Sequencer.RangeScanner - scans the time range by small batches.
    • CDPLogger.ValueLogReader - reads values from the CDPLogger component. In this minimal example, we have not set any filters, so it will read all values in full resolution and forward them to the LogWriter.
    • CDPLogger.LogWriter - writes the received values to a new Datastore (CSVDatastore in this example).
  • Optionally, add two Sequencer.DebugPrinter blocks to print any Error messages.
  • Add a CDPLogger.CSVDatastore into the LogWriter block to store extracted values in a CSV file.
  • Right-click on the CPULoad signal in the application and use the Add to Logger... menu to add it to the CDPLogger component.
  • Connect the blocks as shown in the image above.

Possible Improvements

Some ideas not implemented in this minimal example:

  • Instead of directly extracting to LogWriter on localhost, use Retagger and LogDataAggregator to re-tag and serialize the data for uploading to a cloud service. In the cloud side, deserialize using LogDataDisaggregator before passing the data to LogWriter. This way multiple edge devices can upload data to a central cloud database.
  • Replace the CSVDatastore in the LogWriter block with a time-series database such as InfluxDatastore for better performance, scalability and data analysis capabilities.
  • Set the Resolution (Hz) property to a non-zero value to extract low-resolution data for long-term storage.

EventLogReader LogWriter

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top