Log Monitoring Extension

Log Monitoring Extension

 

Use Case 

Use for monitoring log files to report:

  • the no of occurrences of each search term provided
  • filesize

Typical usage is counting how many 'Warn' and/or 'Error' are logged.

 

This extension only works with standalone machine agent.

 

Installation

  1. Download LogMonitor-<version>.zip and unzip it to <machine_agent_dir>/monitors/
  2. Edit config.yaml file in LogMonitor/conf file and provide the required configuration (see Configuration section)

  3. Restart the Machine Agent.

Configuration

 

config.yaml

Note: Please avoid using tab (\t) when editing yaml files. You may want to validate the yaml file using a yaml validator.

 

ParamDescription

displayName

The display name of the log file. If not specified, logName is used by default.

logDirectory

The directory path where the log is located.

logName

The name of the log file, i.e. server.log. Supports wildcard character for filename that changes dynamically on rotation, e.g. server-*.log

searchStrings/displayName

Display name for this pattern

searchStrings/pattern

The strings to search, e.g. "debug", "info", "error". Supports regex if matchExactString is set to false. Note, this is case insensitive regardless.

searchStrings/matchExactString

Allowed values: true or false. Set to true if you only want to match the exact string, otherwise set to false forregexsupport and contains in string.

searchStrings/caseSensitive

Allowed values: true or false. Set to true if you want the search to be case sensitive, otherwise false

-----

-----

noOfThreads

 The no of threads used to process multiple logs concurrently

metricPrefix

 The path prefix for viewing metrics in the metric browser. Default value is "Custom Metrics|LogMonitor|"

 

Below is an example config with multiple log files to monitor, one of which uses the dynamic filename and search string regex support.

 

logs:
  - displayName: "Machine Agent Log"
    logDirectory: "/Users/Muddam/AppDynamics/MachineAgent_4.1.2/logs"
    logName: "machine-agent.log"
    searchStrings:
        #displayName Should be unique across the patterns including the case.
       - displayName: "Debug In Caps"
         pattern: "DEBUG"
         matchExactString: false
         caseSensitive: true
       - displayName: "Debug"
         pattern: "Debug"
         matchExactString: false
         caseSensitive: true
       - displayName: "Info"
         pattern: "Info"
         matchExactString: false
         caseSensitive: false
       - displayName: "DynamicLog"
         pattern: "system\\w+"
         matchExactString: false
         caseSensitive: false

        
# Number of concurrent threads
noOfThreads: 3

#prefix used to show up metrics in AppDynamics 
metricPrefix: "Custom Metrics|LogMonitor|"

 

Metric Path

Application Infrastructure Performance|<Tier>|Custom Metrics|LogMonitor|<LogName>|Search String|<searchStrings displayName>|<Matched Term>

 

Application Infrastructure Performance|<Tier>|Custom Metrics|LogMonitor|<LogName>|File size (Bytes)

 

Custom Dashboard

LogMonitorCustomDashboard.png

 

Version

VersionDateNotes
1.0.028 May 2014Initial release
1.1.021 Nov 2014Added flag for matching exact string
1.1.124 Apr 2015Fixed filepointer path issue
2.0.05 May 2015Added support for dynamic filename, search string regex and concurrency.
Moved config to yaml
2.0.117 Dec 2015Added support for case sensitive search

 

Contributing

Always feel free to fork and contribute any changes directly here on GitHub

 

Support

For any questions or feature request, please contact AppDynamics Center of Excellence.