Submit a ticketCall us

Looking to compare latest NPM features with previous versions of NPM?
The NPM new feature summary offers a comparison of new features and improvements offered with this release.

 

Home > Success Center > Kiwi Syslog Server > Kiwi Syslog Server Administrator Guide > Add rules, filters, and actions > Add an action > Add an action to log messages to a database

Add an action to log messages to a database

This feature is available only in the licensed version.

You can add an action to log a syslog message to an ODBC database. By default, the Log to Database action logs the following message field values:

  • Date
  • Time
  • Priority
  • Host name
  • Message text

If you want to log different values, you can:

  • Create a custom database format. The custom format will be available for selection when you create a Log to Database action.

  • Use the Run script action to parse the syslog message, assign values to custom fields, and log them to a database.

  • Use the scripting function ActionLogToODBC to send SQL statements and raw data to a database connection.

Prepare the database

  1. Create a database, or select an existing database that Kiwi Syslog Server can write to.

    If the database file is opened exclusively by another process, Kiwi Syslog Server might not be able to write new records to the database.

    Some example ODBC databases are available for download from the SolarWinds Success Center. The ZIP file contains information and sample databases that you can use as a guide to help you set up ODBC logging on your own system.

  2. Determine how you want to create the table that stores message values. The following options are available:

    Automated option When you add the action, click Create table. Kiwi Syslog Server creates a table containing the required columns.
    Semi-automated option When you add the action, click Show SQL commands. The SQL commands used to create the table are shown in a text editor. You can run these commands in your database application.
    Manual option If you choose to create the table manually before you add the action, use the table design for the selected database type. Be sure that the name, data type, and size of each column match the table design. If the sizes are too small, the data could be truncated when it is written to the database.

Add the action

  1. From the Kiwi Syslog Service Manager, choose File > Setup.
  2. Add or locate the rule that the action applies to.
  3. Right-click the Actions node below the rule, and choose Add Action.
  4. Replace the default name with a descriptive name. (The name does not have to be unique.)
  5. From the Action menu, select Log to Database.

  6. Specify the following options.

    Data link connection string
    1. Press the Browse (...) button to create or edit Data link properties.

      The Data Link Properties dialog box opens.

    2. On the Provider tab, select a database provider.

    3. On the Connection tab, specify the source of the data by doing one of the following:
      • Select the data source name (DSN) of an available provider. The drop-down menu lists valid DSNs for providers that are predefined on your system.
      • Enter a custom connection string.
    4. Click Test Connection to validate that the connection properties are correct.
    5. Use the Advanced tab to view and set other initialization properties for your data.
    6. Click OK.
    Database Table name

    Enter the name of the database table where message values are logged. You can either:

    • Enter an existing table name. The table must match the expected table design.

      To verify the table structure, click Query table to retrieve the last five rows of data.

    • Create a new table:

      1. Specify the database type (below).
      2. Enter a table name.
      3. Click Create table.

      Any existing table with that name is deleted and the contents are lost. The new table is created with the column names and data types for the database type you have selected.

    Database type/field format

    Choose from the list of default database types, or create your own format by clicking Edit custom format.

    Connection Inactivity timeout

    Specify how long the database connection is kept open after the last message has been sent. Because opening and closing the connection can be the slowest part of logging to a database, the connection is kept open while data is actively being logged. If no more messages have been logged before the timeout value expires, the database connection is closed. As soon as a new message arrives, the connection is reopened.

    The default for this setting is 600 seconds (10 minutes). A value of 0 ensures that the connection will never time out. The maximum value is 86400 seconds (1 day).

    Run debug command

    If there is a problem logging to the database, click this button and enter a SQL command to be executed on the database. If the command fails, the results field displays a detailed error message. By default, the current INSERT statement used for the selected database type is displayed in the query field. This statement can be modified to test particular variations of the statement.

    • You cannot use this option to query the database. For example, you cannot run a Select From statement and obtain results. Only error information is returned to the results field.
    • Use the Show SQL commands button to obtain the correct syntax to use in the debug test.
    Database cleanup

    Select this option to clean up the database by deleting older messages.

    The cleanup operation is performed nightly. Click Cleanup now to perform the operation immediately.

  7. (Optional) Test the action.
  8. Click Apply to save the action.

When you test logging messages from the Service Manager, the program runs as the current user (probably "Administrator"). When Kiwi Syslog Server actually logs messages to a database, the service runs as the "Local System" user by default.

If your test messages work but the messages are not being logged, try changing the service login ID to "Administrator" instead of "Local System." Use the Services applet under Control Panel. Also consider selecting the option that allows the program to interact with the desktop.

Last modified
15:11, 30 Mar 2017

Tags

Classifications

Public