Logging in DIA

Hello,
I am trying to use the file logger provided with Dia.

The problem I am facing is:

  • There is no documentation whatsoever of any example of the file_logger provided.
  • No explanation of the logger parameters/settings and their units.

I would like to log data to a USB flash drive on the gateway.

Then the other issue is:
What is the format of the log file? Can we import that into a database to create graphs?

Any help?

Thank you,
Naji

Hi Naji,

Some documentation exists for the File logger in the Dia Sphinx documentation. You can get it by going to here: https://developer.idigi.com/home.do

You’ll have to register an account, but afterwards can login and select the documentation link on the left hand side, then select the Dia’s documentation link.

To answer some questions that are not in the documentation:

What is the format of the log file? Can we import that into a database to create graphs?

The log file is a proprietary format designed for Digi’s platforms, and is not intended to be read directly through a text editor or a spreadsheet program. The reasons for this was to improve performance on the platform and save flash space.

With that said, a user has a few options in importing the file logger contents into another format or into a database store.

The first step will be to copy the log file to a PC with the Dia source on it. You’ll get better network savings if you transfer it in its compressed form rather than through queries.

Once you have the log file, you can run the Dia locally using the presentation of choice and file logger directed at the file. NOTE It is critical that you use only the file logger and a presentation while doing this. Otherwise you risk having log entries being overwritten The viable presentations are: RCI, Console and XMLRPC. I would recommend using the XMLRPC presentation.

I’m assuming that in the second step you used the XMLRPC presentation. Using a XMLRPC client of your choice, set the active logger in the presentation to the file logger, then query it as you want to extract entries.

The other presentations follow the same procedure, just using whatever communication protocol they entail. For advanced users who are familiar with scripting, the Console presentation and a good regex may be the better way, due to the logger_iterate command.

Hope that answers your questions,
Max

Hello,
I have seen the documentation already that is provided with Dia1219. There is no example described in there, unless I missed it.

  1. I am looking for a YML example for the file logger as there are some parameters that I do not understand and they are not explained in the python code (file_logger.py). Can I have an explanation of these please?

  2. Thank you for sharing a way to extract the logs, but the problem is that you need to manually copy the log file to a separate Dia instance and then query values one by one.

The scenario required is one where there is real-time online access to current and historical data, ideally in a database ready format to create graphs.
From what I learn from you, this does not exist and one needs to write his own logger that would actually write data into a database.
Perhaps this should be added to a wish list for the Dia developers as there is no point -for many- to have historical data in a proprietary format and have it tied to the gateway ony.

Please let me know.

Regards,
Naji

Naji,
I too am looking at the file_logger. There is an example of how/where to utilize the logger information in your yml file. It is in the demos/auotenum/dia.yml file.
Basically, you write your logger info after your presentations are finished. Something like this:

presentations:

  • name: console0
    driver: presentations.console.console:Console
    settings:
    type: tcp
    port: 4146

loggers:

  • name: embedded_log
    driver: channels.logging.file_logger.file_logger:FileLogger
    settings:
    filename: WEB/python/idigi_dia.log
    event_volume_size_k: 256
    sample_index_frequency: 128

I have gotten as far as starting the logger and generating the log file. However, I do not know how to read the log file that is generated. Any help on this?

bronzecraft: You can read the log file through a telnet connection to your gateway to port 4146.

On the cmd windows (ms-dos) type:

c:\Documents and Settings\admin>telnet Your Gateway IP 4146

You’ll see:

Welcome to the iDigi Device Integration Application CLI
=>>logger_set embedded_log (*in your case)
Logger set to embedded_log
=>>logger_iterate 5 10
etc…

Of course, you can do the same on the tab “Demo CLI” in Digi ESP for python software.

Hope I’ve helped.