The Free Text Parsing Language

The free text parsing language enables to parse an input string, extract information, and define log fields. These log fields which show as part of the Check Point log in the Log ServerClosed Dedicated Check Point server that runs Check Point software to store and process logs.. They are used in the definition of events. Each parsing file contains a tree of commands. Each command examines or parses part of the input string (sometimes it adds fields to the log as a result), and decides if to continue to parse the string (according to the success/failure of its execution).

The Commands

Each command consists of these parts:

  • cmd_name - the name of the command.

  • command arguments - arguments that define the behavior of the command.

  • on_success (optional) - the next command executed if the current command execution succeeds.

  • on_fail (optional) - the next command executed if the current command execution fails.

Sample

:command (
   :cmd_name (try)
   :try_arguments
        .
        .
   :on_success (
       :command()
   )
   :on_fail (
       :command()
   )
)

Try

The try command matches a regular expression against the input string.

'Try' Command Parameters

Argument

Description

parse_from

start_position - run the regular expression from the start of the input string.

last_position - run the regular expression from the last position of the previous successful command.

regexp

The regular expression to match.

add_field

One or more fields to add to the result (only if the regular expression is successful).

Group_try

The command group_try executes one or more commands in one of these modes:

  • "try_all" tries all commands in the group, and ignores the return code of the commands.

  • "try_all_successively" tries all the commands in the group, and ignores the return code of the commands.

    Each command tries to execute from the last position of the earlier successful command.

  • "try_until_success" tries all the commands until one succeeds.

  • "try_until_fail" tries all the commands until one fails.

The command "group_try" is commonly used when it parses a "free-text" piece of a log, which contains a number of fields we want to extract.

For example:

%PIX-6-605004: Login denied from 194.29.40.24/4813 to outside:192.168.35.15/ssh for user 'root'

When you look at see this section of the log, you can use this structure:

Switch

This command enables to compare the result of a specified field against a list of predefined constant values.

'Switch' Command Parameters

Parameter

Description

Parameter

Description

field_name

The field name whose value is checked.

case

One or more case attributes followed by the value with which to compare.

default

Execute only if no relevant case is available. The default value is optional.

Unconditional_try

This command is an "empty" command that allows you to add fields to the result without any conditions.

Include

This command enables the inclusion of a new parsing file.

file_name

The full path plus the file name of the file to be included.

Add_field

Each "add_field" has some parameters:

  • Type - The type of the "add_field" command. This parameter has these possible values:

    • Index - Part of the regular expression will be extracted as the field. The "field_index" value denotes which part will be extracted (see "field_index" bullet).

    • Const - Add a constant field whose value does not depend on information extracted from the regular expression. See field_value bullet.

  • field_name - the name of the new field.

    There are some fields, which have corresponding columns in SmartConsoleClosed Check Point GUI application used to manage a Check Point environment - configure Security Policies, configure devices, monitor products and events, install updates, and so on. > Logs & Monitor > Logs.

    This table shows the names to give these fields to show in their Logs & Monitor > Logs column (and not in the Information field, where other added fields appear):

    Field Name to be Given

    Column in Logs & Monitor > Logs

    Src

    Source

    Dst

    Destination

    proto

    Protocol

    s_port

    Source Port

    product

    Product

    service

    Service (when resolved includes the port

    and protocol.)

    Action

    Action

    ifname

    Interface

    User

    User

    When you name the above fields accordingly, they are placed in their correct column in Logs & Monitor > Logs.

    This enables them to participate in all filtering done on these columns. These fields automatically take part in existing eventClosed Record of a security or network incident that is based on one or more logs, and on a customizable set of rules that are defined in the Event Policy. definitions with these field names.

  • field_type - the type of the field in the log.

    This table shows the possible field types.

    Field Type

    Comment

    int

     

    uint

     

    string

     

    ipaddr

    For IP addresses used with the Src and Dst fields.

    pri

    Includes the facility and severity of a syslog.

    timestmp

    Includes the date and time of the syslog. Supports the format 'Oct 10 2019 15:05:00'.

    time

    Supports the format '15:05:00'.

    string_id

    For a more efficient usage of strings. Used when there is a finite number of possible values for this field.

    action

    Supports these actions: drop, reject, accept, encrypt, decrypt, vpnroute, keyinst, authorize, deauthorize, authcrypt, and default.

    ifdir

    0 - inbound

    1 - outbound

    ifname

    For an interface name (used with the "ifname" field).

    protocol

    The field name should be "proto".

    port

    For "service", "s_port" or "port" fields.

    The field type of the field names in this table must be as mentioned:

    Field Name

    Field Type

    Src

    ipaddr

    Dst

    ipaddr

    proto

    protocol

    s_port

    port

    service

    port

    Action

    action

    ifname

    ifname

  • field_index or field_value - The parameter used depends on the value of the "type" field.

    • If the "type" field is index, the "field_index" shows.

    • If the "type" field is const, the "field_value" shows.

    The "field_index" denotes which part of the regular expression is extracted, according to the grouping of the patterns.

    To make this grouping, write a certain expression in brackets.

    In this expression, the number in the "field_index" denotes the bracket number whose pattern is taken into account.

  • dict_name is the name of the dictionary to use to convert the value. If the value is not found in the dictionary, the value is the result.

    The free text parser enables us to use dictionaries to convert values from the log. These conversions are used to translate values from logs from different devices, with the same meaning, into a common value, which is used in the event definitions.

    Each dictionary file is defined as an .ini file.

    In the .ini file the section name is the dictionary name and the values are the dictionary values (each dictionary can include one or more sections).

    [dictionary_name]

    Name1 = val1

    Name2 = val2

    [cisco_action]       [3com_action]

    permitted = accept   Permit    = accept

    denied = reject      Deny   = reject