Configuring an adapter for live application monitoring

The Generic Log Adapter provides an outputter class that allows the Common Base Event objects generated by your adapter to be sent to a logging agent. The Log and Trace Analyzer can be used to attach to the logging agent, to monitor and to analyze the application log in real time.

Prerequisites:

Please follow these steps to configure your adapter for monitoring.

Update the Outputter component

Note: When a new adapter configuration file is created, it is configured to use the CBELogOutputter class by default. If you have not changed this setting, you can skip this procedure.

The outputter component in the adapter configuration file needs to be updated to use the CBELogOutputter class which writes the Common Base Event objects to a logging agent. You can either update the existing Outputter Component or add a new Outputter component.

To add a new outputter component:

  1. To edit the adapter configuration file, select the adapter configuration file in the Navigator pane. Right-click and select Open with > Adapter Configuration Editor. The file is opened in the editor.
  2. In the Adapter Configuration Editor window, expand the Adapter > Configuration > Context Instance node.
  3. Right-click on the Context Instance and select Add > Outputter. A new outputter is created in the Context Instance.
  4. In the Outputter Type field, select LoggingAgentOutputter.
  5. Click on the agentName property. The property details are shown in the right pane.
  6. Update the property value with the desired logging agent name. This is the name that you will see in the Log and Trace Analyzer as the Logging Agent to monitor.
  7. If you want the outputter to wait before logging information to the CBELogOutputter class, add a property called waitUntilLoggingTime and set the value of the property to the time in milliseconds. To add the property, right-click on the newly created Outputter and select Add > Property. A new property is created under the new Outputter node.
  8. To enable the CBELogOutputter class, you need to create the associated Outputter component in the Contexts Basic Context Implementation. Open Contexts > Context Basic Implementation Context.
  9. Right-click on Context Basic Implementation Context and select Add > Component. A new component is added to the context.
  10. Configure the new component with the following values:
    Name: Outputter name in the context
    Description: Description of what this outputter does
    Executable class: org.eclipse.hyades.logging.adapter.outputters.CBELogOutputter
    Logging level:The level of internal logging the outputter component should use.
    A value of 99 means the outputter will not log any messages.
    A value of 0 means the outputter will log messages of all severities.
    The recommended value is 50 which means that only Critical or Fatal internal outputter errors messages are logged.
    Role: Outputter
    UniqueID: Must point to the outputter defined in the Context Instance in step 2. Use the Browse button to select the correct ID.
  11. Save the adapter configuration file changes.

Update the context instance

If you want the log parser to be monitor the log file continuously, you need to update the context instance properties of the adapter configuration file for continuous operation.

  1. To edit the adapter configuration file, select the adapter configuration file in the Navigator perspective. Right-click and select Open with > Adapter Configuration Editor. The file is opened in the editor.
  2. In the editor window, select Adapter > Configuration > Context Instance . The Context Instance details are displayed in the right pane.
  3. Select the Continuous Operation check box.
  4. Configure the Maximum Idle Time and Pause Interval fields as required.
  5. Save the adapter configuration file changes.

Launch the Java process to run the adapter

The log adapter you created can be run externally from a batch file in the Windows environment or a shell script in non-Windows environments. Below are sample files that can be used to launch the Java process that will run your log adapter.
Note: To run the Generic Log Adapter on a system, Hyades must be installed on that system.

Windows batch file:

@rem USAGE:  runregex
@rem Change the following lines to point to the directory where you unzipped the runtime
@rem and the directory where your log adapter resides 
SET HYADES_HOME=d:\hyadesDC
SET YOUR_ADAPTER_DIRECTORY=MyAdapterDirectory
SET CONFIG_FILE=%HYADES_HOME%\%YOUR_ADAPTER_DIRECTORY%\myadapter.adapter
PUSHD %HYADES_HOME%\%YOUR_ADAPTER_DIRECTORY%
java -classpath "%HYADES_HOME%\lib\glaconfigs.jar;%HYADES_HOME%\lib\hexr.jar;%HYADES_HOME%\lib\hgla.jar;%HYADES_HOME%\lib\hglaconfig.jar;%HYADES_HOME%\lib\hlcore.jar;%HYADES_HOME%\lib\hlevents.jar;%HYADES_HOME%\lib\hparse.jar;;%HYADES_HOME%\lib\logparsers.jar;%HYADES_HOME%\lib\xalan.jar;" org.eclipse.hyades.logging.adapter.Adapter -ac "%CONFIG_FILE%" -cc "%CONFIG_FILE%"
POPD

non-Windows batch file:
#!/bin/sh
# USAGE:  runregex_example.sh
# Change the following line to point to the directory where you unzipped the runtime
HYADES_HOME=/home/hyadesDC
export HYADES_HOME
YOUR_DIRECTORY=/yourdirectory
export YOUR_DIRECTORY

CONFIG_FILE=$HYADES_HOME/$YOUR_DIRECTORY/myadapter.adapter
export CONFIG_FILE

CUR_DIR=`pwd`
export CUR_DIR

cd $HYADES_HOME/$YOUR_DIRECTORY

java -classpath "$HYADES_HOME\lib\glaconfigs.jar;$HYADES_HOME\lib\hexr.jar;$HYADES_HOME\lib\hgla.jar;$HYADES_HOME\lib\hglaconfig.jar;$HYADES_HOME\lib\hlcore.jar;$HYADES_HOME\lib\hlevents.jar;$HYADES_HOME\lib\hparse.jar;;$HYADES_HOME\lib\logparsers.jar;$HYADES_HOME\lib\xalan.jar;" org.eclipse.hyades.logging.adapter.Adapter -ac "$CONFIG_FILE" -cc "$CONFIG_FILE"
cd $CUR_DIR

Configure the file as required to launch the Java process that will run your adapter.

Monitoring the live application log

You are now ready to monitor the live application log.

  1. Ensure that logging is enabled in the preferences.
    1. From the main toolbar, select Window > Preferences . The Preferences wizard opens.
    2. Select Profiling and Logging from the left pane. The Profiling and Logging preferences are loaded in the right pane.
    3. Select Enable logging under Profiling and Logging options.

      Enable logging check box is selected in the preferences pane for Profiling and Logging

    4. Select OK to apply the changes.
  2. In the Profiling and Logging perspective, click the Profiling Icon of profiling tool icon in the toolbar and select Profile. The Profile wizard opens.
  3. Select Attach - Java Process and click the New button at the bottom of the list. A new Java process configuration is created.
  4. Click the Hosts tab and select the host on which the application log resides.
    Note: To monitor a live application log, the Hyades Data Collection Engine must be running on the same system as the application.
  5. Click the Agents tab and use the arrow keys to select the logging agent that you configured.

    In the profiling preferences wizard, the logging agent the user created is on the left pane

  6. Click Apply.
  7. Click Run to attach to the Logging agent.
  8. In the Profiling and Logging perspective in the Profiling Monitor view, select the logging agent.
  9. Right-click on the agent and select Start monitoring.
  10. Right-click on the agent and select Open with > Log View. The log events from the application log are loaded into the Log view.

 

Related Concepts
Overview of the Hyades Generic Log Adapter
Common Base Event format specification

Related tasks
Creating a log parser

Related references
Adapter Configuration File structure
Adapter Configuration Editor
Regular expression grammar