Author Topic: Improved "log.sh"  (Read 188 times)

Offline rge

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +7/-0
Improved "log.sh"
« on: February 07, 2017, 01:53:03 pm »
I tried using http://<veraip>/cgi-bin/cmh/log.sh?Device=luaupnp and found several issues:

* the output is not correctly HTML encoded
* no way to grep
* the output is forced to be on a black background

Checking the source, it basically uses a cut down version of ansi2html that doesn't seem to do any HTML encoding except trying to colour code stuff, so anything that looks like a <tag> gets lost. And the colour coding anyway sucks.

So I modified it to create log2.sh (attached) which seems to work properly when put into the same folder (/www/cgi-bin/cmh)

* output is now text/plain - no need to bother with HTML encoding
* supports a grep pattern in the Grep parameter - e.g. for checking LUA output:

http://<veraip>/cgi-bin/cmh/log2.sh?Device=luaupnp&Grep=^50

MCV - if anyone reads this, maybe replace your log.sh with one like this that is a bit more useful and reliable?