Dealing with increased log entries in OH4

After upgrading to OH4, I noticed that the events log fills up and rotates quickly. I believe this is related to the new ItemUpdatedStateEvent. This makes a little more difficult to troubleshoot because I have to search through more log files and hope that the information I need hasn’t already aged out.

openhabian@openhabian-spring4:/var/log/openhab $ ls -l
total 31760
-rw-rw-r-- 1 openhab openhab        0 Jul  4 09:37 audit.log
-rw-r--r-- 1 openhab openhab 15029384 Aug 14 12:46 events.log
-rw-r--r-- 1 openhab openhab  1274081 Aug 12 22:07 events.log.1.gz
-rw-r--r-- 1 openhab openhab  1274039 Aug 13 03:28 events.log.2.gz
-rw-r--r-- 1 openhab openhab  1268488 Aug 13 09:08 events.log.3.gz
-rw-r--r-- 1 openhab openhab  1250981 Aug 13 14:32 events.log.4.gz
-rw-r--r-- 1 openhab openhab  1238606 Aug 13 20:20 events.log.5.gz
-rw-r--r-- 1 openhab openhab  1234519 Aug 14 02:31 events.log.6.gz
-rw-r--r-- 1 openhab openhab  1246049 Aug 14 07:53 events.log.7.gz
-rw-r--r-- 1 openhab openhab  8558884 Aug 14 12:38 openhab.log
-rw-r--r-- 1 openhab openhab    38575 Jul 25 10:26 openhab.log.1.gz
-rw-r--r-- 1 openhab openhab     8776 Jul 25 10:39 openhab.log.2.gz
-rw-r--r-- 1 openhab openhab    12044 Jul 25 10:55 openhab.log.3.gz
-rw-r--r-- 1 openhab openhab    17613 Jul 25 11:21 openhab.log.4.gz
-rw-r--r-- 1 openhab openhab     5750 Jul 25 11:35 openhab.log.5.gz
-rw-r--r-- 1 openhab openhab    19706 Jul 25 14:11 openhab.log.6.gz
-rw-r--r-- 1 openhab openhab      250 Aug  6 06:42 openhab.log.7.gz
-rwxr-xr-x 1 openhab openhab        0 Jul 23 17:41 Readme.txt

I looked at this documentation:

and searched the forum, but could not figure out what to do, so I’m asking for help.

First, is there a way to make the event log bigger, or keep more versions around before the age out and disappear?

Second, is there a better way to extract the information I want from the logs than my current practices, which are:

  1. using the Frontail output on port 9001 (with the increased flow of data, I’m find this less useful for anything other than just watching what is happening in real time, and
  2. filtering the logs (events and openhab separately) using ssh to the Pi and running cat (or zcat for compressed files) LogName | grep -i searchterm, sometime with multiple levels of grepping to narrow it down. Often once I find the timestamp of the triggering event, I then grep by that time.

I’m guessing and hoping there is an easier way that I haven’t stumbled across yet.

System information (which I just noticed show the Bindings are null. Everything is working fine, but I suppose I should restart openHAB and see if that null persists).

runtimeInfo:
  version: 4.0.1
  buildString: Release Build
locale: en-US
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.7
  javaVendor: Raspbian
  osName: Linux
  osVersion: 6.1.21-v8+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 165518864
  totalMemory: 778567680
  startLevel: 100
bindings: null
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1.5
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: en-US
    languages:
      - en-US
      - en
    onLine: true
    platform: Win32
  screen:
    width: 1707
    height: 1067
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/115.0.0.0 Safari/537.36
timestamp: 2023-08-14T18:08:07.562Z

I appreciate any suggestions.

:sunglasses:

Of course. Look at the settings for the appender for event.log in $OH_USERDATA/etc/log4j2.xml. There’s a property that dictates how large the file can grown before it’s rolled over. You can also change how many files to keep.

Thanks. I found that. Is there a size that becomes too big? I guess I’ll try going to 32 MB from the current 16 MB, and double the number of files to keep. I think I still have plenty of room.

Does it take effect immediately, or do I have to restart openHAB or something else first?

Thanks again for your help