views:

185

answers:

8

I'm working on an embedded system and it uses one serial port for all it's logging purposes.

Is there a tool out there that allows you to filter lines into different windows (or remove them altogether) so that I can separate the output of the various logging sub-systems and remove spam messages that show up multiple times a second?

I'd prefer an open-source solution, but a highly-recommend closed product might do.

+4  A: 

I've never thought of doing such a thing, but here's one product that might do the trick: Eltima Serial Port Splitter. It claims to be able to take one COM port and turn it into multiple virtual ports to connect to many applications. You might be able to take each application and just look at one kind of output.

Personally, I would just write a python script with PySerial and something like PyQT or wxPython (GUI libraries) to filter the data to different windows. It's an easy language to learn and makes a handy tool for embedded systems development for things such as this.

DoxaLogos
+1 for the Python + PySerial + (PyQt|wxPython|Tkinter|PyGtk|ncurses|..) way
redShadow
+1  A: 

I guess it will depend on the format your logs have. If they looks like (or you can make them look like) the syslog format, you can try the following:

http://sourceforge.net/projects/logwatch/ http://xjack.org/logtool/

Alejandro
+2  A: 

I would do the following:

Use Python.

Write a Python program to read the serial data from the device, and translate it into log item for Python's logging module.

  • If your device's log messages have some sort of source identifier, translate that to a Python "logger" name according to your needs, using the getLogger() function. You can define logger names any way that you need, e.g. to define log source or category.
  • If your device's log messages have a severity indication, translate it to the lvl parameter to the logger's log() method. Otherwise just use one of the logger methods such as info().

Make use of the Python logging module's config file feature to filter the data as you want in a particular situation.

  • You can filter particular log items by severity and logger name.
  • You can log to multiple destinations: You can filter and print certain log items to screen, and at the same time filter and print certain log items to one or more files. You can mix these in any combination that you want. It's very flexible.
  • You could have several logging config files, for several different logging purposes, and simply specify which one you want to use via the command line each time you run your program.

I've used Python's logging module with config files to set up my filtering, and it's really terrific.

Craig McQueen
A: 

SmarTerm allows you to connect to many different serial ports in a tabbed interface. It also has a Visual Basic

alt text

marked
+1  A: 

I would personally use the Python method described above, but another (relatively easy) way to go about it would be to use sed.

Build a couple different filters to show precisely what you want from the stream, and then pipe in tail -f of your serial device file.

Paul McMillan
A: 

Use screen with grep and tail.

sanmai
A: 

My first choice is to always run PortMon (originally from SysInternals). It has a filter option where you can type in strings to include, exclude, or highlight:

alt text

I have used this for years on Windows NT/2000/XP with great success.

Hopefully, you're running a 32-bit Windows OS, because if you're running 64bit, you'll have to go with something like Eltima's product.

Dave
A: 

There's always the venerable protocol analyzer.

http://shop.ebay.com/?_from=R40&_trksid=p3907.m570.l1313&_nkw=RS-232+protocol+analyzer&_sacat=See-All-Categories

You might only get one color on the screen, but it's a platform independent serial port logging solution.

bde
Seems like this is the expensive way to get 3 different filtered views of the same data stream--wouldn't it require 3 protocol analyzers?
Bill K