Skip to main content

LogMonitor Integration Service

ZenPacks.zenoss.PS.LogMonitor

About

ZenPack that monitors specified files (presumably log files) or directories for size or number of matches. This integration is limited to the specific use cases defined below regarding search, match, and scale limitations.

Prerequisite

Restriction

Product

Tested with Zenoss 6.4.1 and higher

Required ZenPacks

PythonCollector ZenPack >=1.6.1

Microsoft Windows ZenPack >=2.7.3

ZenPackLib ZenPack >=2.0.0

ZenPacks.PS.Util >=1.1.0

Other dependencies

None

Modelers

  • LogMonitor.AdvancedLogSearches Advanced Log Search components

  • LogMonitor.zProperties Log Search, Directory Search, and Size Check Search components

Installation / Usage / Removal

Install this ZenPack following the instructions in the Virtana Admin Guide matching your Zenoss version.

Supported Operating Systems

  • Windows

  • AIX (SSH Only)

  • Linux (SSH Only)

  • Solaris (SSH Only) (Only Log Search, Directory Search, and Size Check supported on Solaris)

Note: Due to a limitation of the Windows FINDSTR utility, regular expression alternation is not supported when specifying a Search Pattern. This means you can not specify a list of patterns for which to search. You'd have to create multiple components to work around this. On UNIX devices you can specify multiple patterns on new lines.

Configuration and Usage

Log Search, Directory Search, and Size Check Search components

There are two methods one can add these component types

  1. Manually adding via the Virtana Service Dynamics web user interface, selecting the corresponding option in the "+" button from the lower left.

  2. Component configuration defined in a zProperty and the component is added as part of the model cycle.

    Component type

    zProperty name to define configuration

    Log Search

    zLogSearchInstances

    Directory Search

    zDirectorySearchInstances

    Size Check

    zSizeCheckInstances

Note

The three component types have a "zPropertyDefined" property that can be seen under details, labeled as "Component configured in zProperty". This is an indicator of how the component was added to zenoss, manually or via modeling/zProperty.

Note

If a configuration change is made to zLogSearchInstances, zDirectorySearchInstances, or zSizeCheckInstances those changes will not be applied to monitoring until the next modeler run.

Log Search Component

Description: Simple Log Search monitoring

Configuration parameters:

Parameter

Description

"ID" / "Log Search ID"

Component ID value

Base Path

Base directory path to apply "Filename Pattern" against

Filename Pattern

Pattern to apply to match log file name

"Search Patterns" / "Array of search patterns to apply"

Regular expressions to apply against any matching file. Each regexp separated by a line-break.

"No log found event" / "Generate event if log file is not found?"

Generate an event if no file matches filename pattern

Directory Search Component

Description: Search for filenames found in a Directory monitoring

Configuration parameters:

Parameter

Description

"ID" / "Directory Search ID"

Component ID value

Base Path

Base directory path to apply "Filename Pattern" against

Filename Pattern

Pattern to apply to match log file name

Search Recursively

Search for files only in the base directory or include subdirectories in the search

Size Check Component

Description: Total size of all files in a Directory monitor

Configuration parameters:

Parameter

Description

"ID" / "Size Check ID"

Component ID value

Base Path

Base directory path to perform size check

Advanced Log Searches

Advanced Log Searches allow for more flexibility in log monitoring, including

  • two types of searches - "String" search, to track number of occurrences of a pattern, and "DataPoint within String" search, which can use a regular expression to extract a number from a specific string

  • Search only from the last position read

  • Graph and threshold based on the number of matches

Configuration Properties

zAdvancedLogSearches

This is the main zProperty for Advanced Log Searches. When you edit this property, a special edit dialog will pop up that allows you to add and edit advanced log searches.

The following steps must be followed to enter and save the log searches:

  1. Enter information in the fields

  2. Click "Add", or "Update" (if editing an existing search)

  3. IMPORTANT Your new or updated search has not been saved until you click "Submit" to update the zAdvancedLogSearchesProperty

  4. After you have clicked "Submit", you need to either remodel the device or wait until the next modeling cycle for the Advanced Log Search components to appear

zLogSearchMaximumSizeInMB

If a log file in a search is larger than the specified size (in megabytes), the search will not be performed and a warning event will be generated

zLogSearchTimeout

In Seconds. If a log search takes longer than the specified number of seconds to return with data, the data is still stored, but a warning event will be generated informing of how long the search took. Default is set to a low number, as most searches should come back quickly, but a good rule of thumb is to set it to slightly shorter than the cycle time to guarantee that searches aren't stepping on each other.

Note

THE FOLLOWING ZPROPERTIES ARE CURRENTLY ONLY IN USE FOR WINDOWS SEARCHES

  • zLogSearchSleepAfterLines

  • zLogSearchSleepMilliseconds

These two properties work together to help mitigate a performance hit on the Windows server. As the search goes line by line through the log file, the script can be set to pause every "zLogSearchSleepAfterLines" lines, for "zLogSearchSleepMilliseconds" milliseconds. Default is set to 1ms/2500 lines.

Changelog

1.5.0

  • Fixes:

    • SVC-2926: Separating out the Windows SingleInteger and LogSearch parsersSVC-3145: add migration for wrong targetPythonClass

1.4.4

  • Fixes:

    • SVC-2648 Fix AdvanceLogSearch, moved file pointer store to redis

1.4.3

  • Fixes:

    • SVC-2648 Fix AdvanceLogSearch zenhub ADM causing file position pointer not updating

1.4.2

  • Fixes:

    • SVC-2531: Unix's log_search datasource command update. Differenctial between no file match found & no pattern matches found in file

1.4.1

  • Fixes:

    • SVC-2531: log_search datasource no match result fixUNIX servers returned a null value, thus no graph updatesWindows servers would "File not found" event when no matches were found

1.4.0

  • Fixes:

    • SVC-1993: fix details display for LogSearch componentsSVC-2315: fix impact uncorroborated edgesSVC-1973: fix collection failure when target log file is missingSVC-1683: correct units for match_total datapoint (rate: matches per second)SVC-2485: New method to define Directory & File monitoring via zPropertiesFeatures:SVC-1974: allow for event to be generated if target log file is missingSVC-1683: add matchCount datapoint for abloute number of matches (non-rate)

1.3.1

  • Fixes:

    • targetPythonClass on several templates (caused errors in Zope when loading templates)

1.3.0

    • Add component to max size event.

    • Fix usage of search_patterns property on Virtana Service Dynamics 6.2