[SOLVED] How do you track logs?

i am kinda of a noob when it comes to logs

how can i view OH logs and filter events…
is there any software that can help me

open a ssh connection to your OH2 instance, issue command ‘openhab-cli console’

login using username openhab, pass habopen

log:tail

yes two years of doing that…

a litle hard to see whats going on now system has grown…

3 more options (if on Linux):

  1. tail -f /var/log/openhab2/*.log
  2. Install frontail
  3. Install Karaf Webconsole (works also on Windows)
1 Like

will try!

  1. Install Karaf Webconsole (works also on Windows)

do you know how to do this?

  1. edite the org.ops4j.pax.url.mvn.cfg file and add the maven repository in the last line:
    org.ops4j.pax.url.mvn.repositories=
    https://dl.bintray.com/openhab/mvn/online-repo/2.1@id=openhab@snapshots,
    https://repo1.maven.org/maven2@id=maven.central.repo

  2. then need to install some web console?what is this?

  3. do i need to install maven or is it a part of OH?

First, add the maven repo at the end of your org.ops4j.pax.url.mvn.cfg file
then…

yes, enter in the OH2 console (openhab-cli console or in windows the Karaf console when you run start.bat) and issue the following command: feature:install webconsole
https://karaf.apache.org/manual/latest/webconsole

no, the maven repo is an online storage of files/etc. when you issue the above command, OH2 will download from maven repo the necessary files to install the webconsole

when installed, you can access it from: http://localhost:8080/system/console/logs
(login using: openhab/habopen)

1 Like

very cool thank you!

i will leave complete steps for noobs, its the best that i can do

  1. in karaf type “feature:install webconsole”
  2. go to http://localhost:8080/system/console/logs
  3. ogin using: openhab/habopen

one more Q i see allot of junk

24.10.2018, 21:06:29 INFO Authentication attempt - openhab Apache Karaf :: JAAS :: Modules
24.10.2018, 21:06:29 INFO Authentication succeeded - openhab Apache Karaf :: JAAS :: Modules
24.10.2018, 21:06:29 INFO Authentication attempt - openhab Apache Karaf :: JAAS :: Modules
24.10.2018, 21:06:29 INFO Authentication succeeded - open

any way to filter here ?

beside the log level of Error debug…

Some expanded things one can do with 1 with pipes and grep:

thanks Rich very helpfull!

still i was looking for software like “fidler” that have maybe a GUI(i know you hate that :))
but all the above will help also thanks guys!

by the way, to get rid of this auth spam, edit org.ops4j.pax.logging.cfg and set log4j2.logger.audit.level = OFF under # Security audit logger

when using the webconsole, every http request will log an auth attempt and another success, so you will get alot of auth spam in your logs.

1 Like

I’m trying to add this on a Windows install and am running into a issue.

Error downloading mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.instance/4.1.3

I have edited the org.ops4j.pax.url.mvn.cfg file and placed the REPO1 url.

I have restarted OH,

Ran feature:install webconsole and still receive the error.

I am currently on OH 2.3.0-snaphsot, Build 1204

Any suggestions?

you should add the maven repo at the end of the file:

org.ops4j.pax.url.mvn.repositories= \
	https://dl.bintray.com/openhab/mvn/online-repo/2.3@id=openhab, \
	https://repo1.maven.org/maven2@id=maven.central.repo

this example is from a 2.3 stable (so line 2 maybe a bit different if you are on 2.3 snapshot)

by the way: the webconsole is not that great :slight_smile:

I did not have the trailing “\” on the first line…that did the trick - Thank You!

Any other suggestions for a log viewer for a Windows machine? I’m sick of opening the file and scrolling to the end each time when I am working on something.

  • Squid
2 Likes

I don’t know what to recommend cause I don’t use OH2 on Win. I usually work on Linux and I usually grep stuff.
This post: How to watch and look through logging is good and has Win info also

ok ok new steps i forgat the maven!

  1. in “org.ops4j.pax.url.mvn.cfg” file
    add to file below rows
    org.ops4j.pax.url.mvn.repositories=
    https://dl.bintray.com/openhab/mvn/online-repo/2.3@id=openhab,
    https://repo1.maven.org/maven2@id=maven.central.repo
  2. in karaf type “feature:install webconsole”
  3. go to http://localhost:8080/system/console/logs
  4. login using: openhab/habopen
  5. to get rid of this auth spam, edit org.ops4j.pax.logging.cfg and set log4j2.logger.audit.level = OFF under # Security audit logger

thanks! not that great but cool… maybe i can use node red to filter what i need

oh man i agree …

I can’t promise it works over samba, but the link I provided above on “How to watch and look through logging” also shows how to tail and filter out lines using PowerShell.

For example (copied from that post):

Only shows log entries that contain MyItem in events.log

Posix
tail -F $OH_EVENTS | grep MyItem

Windows
Get-Content $Env:OH_EVENTS -Wait | where { $_ -match "MyItem" }

Read the whole post for how to set the ON_EVENTS environment variable.

Hi just want to say!
not only for tracking logs this server management is very cool!
i recommend all to install this really!

one more Q, when trying to access with
https://home.myopenhab.org/system/console/logs

i get password promoted ,and its not the login from above…

can i even connect , and what is the pass and user?

It should be:

u - openhab
p - habopen

works fine for me - maybe you changed during install?