Saturday, March 26, 2011

Apache log messages on the Infoglobe

The RS232 version of the Infoglobe Interface  is capable to receive RS232 messages from a system, not only from a terminal emulator.
So, in order to test this capability, here a note about how to create a "custom" log message from the server Apache and have it sent to the interface.
In order to send a log message to the interface, we have to create a specific log capable to "fit" the Infoglobe message length.
The infoglobe is capable to display a maximum of 36 characters and also some characters are not available.
Because of that we have to create a log with the minimum information possible.

Log generation

Fortunately is quite simple to create custom log files with Apache.
It's enough to open the http server configuration file (in my case, on CentOS  /etc/httpd/conf/httpd.conf) and create a log generation customized for our needs.
In this configuration file, just search for the word LogFormat.
Usually there are some LogFormat lines in the file.
We have to create our own. Here the line I prepared :
LogFormat "^%{%D,%T}t %h " infoglobe

Basically I want to display only the date/time of the access and the IP.
%t display the time, but since the default format is quite huge, I used the strtime format to create a shorter date/time string.
You can find more information about the log capabilities of Apache in the Apache documentation.

Then in the part of the configuration file where the server is defined (in my case a Virtual server) just create a log entry using the LogFormat you prepared.
In my case :

CustomLog logs/apkh_infoglobe infoglobe

Now every time someone access the server, a file called apkh_infoglobe will contains date/time and IP of the access, something like :


Note the first character.
When the Infoglobe interface receive the character '^' will display the message in rotation.

Log presentation

After restarting the server (every modification to the configuration file will require a restart of the server), every access will add a line the log file.
To send the log file, in automatic way, to the Infoglobe, is enough to use this command, assuming of course the /dev/ttyS0 (equivalent to COM1 under DOS) is connected to the Infoglobe interface :

# tail -f -n 1 log_file > /dev/ttyS0

In my example :

# tail -f -n 1 apkh_infoglobe > /dev/ttyS0

After that, every access to the server will be showed up on the Infoglobe.
That's it !

Here an extract of the log file apkh_infoglobe :


Important to remember that the tail command is sending always the LAST line as soon as it is generated.
Here a picture of the Infoglobe showing the temperature :

Here the Infoglobe showing an IP from the log :


  1. Hi, My embedded board is still in the mail so I am only able to use my imagination to what can be done with it. I have coded up the arduino code and the python parts to get the weather/news to the info globe. That will have to wait till the controller arrives.
    You mention the RS232 version of the infoglobe. I am assuming it is a version that you implemented. Could you elaborate (I need to experiment on it once I have my setup) as to what transitions you use to show 1 line of message, wait for a sufficient amount of time and then show the next line of message. What would be a good way to split up a message larger than 35 bytes to display smoothly without any breaks/ pauses.


    p.s. I see you have a tail 1 - so it is just one line. Is there any workaround to show the unsupported characters like %&+; etc

  2. Hi RR
    The interface I built is a RS232 version. I originally planned to use ZigBee for the connection but I didn't do anything else so far, too busy with other things (somebody call that "life" :-) ).
    About your other question ... well hard to say.
    By it's nature, Infoglobe is great to display short messages, there is no an easy way to display messages longer than 36 chars and "bind" together messages is only good to leave you with headache :-)
    Under normal use I doubt you can stare to the Infoglobe more than few seconds, i.e. is great for alarm/short messages, not to read weather reports or news.
    Maybe it's just me, but the bottom line is that I never explored how to bind long messages because I considered it useless.
    In this example (Apache log) I reduced the useful info into 36 characters.

    And for the unsupported characters, I didn't do much. I remember to have seen something time ago but I never did experiment.
    I have also a Infoglobe color (!!) to modify and I suppose it has extra code to manage the color (you can change the message color !).
    But until now I'm working on other stuff :)