PlatformLogCollector

Version 2

    Introduction

    • The Java based tool to collect the Logs from the Informatica server machine
    • Addresses challenges in the InfaLogs collector.
      • Works in multiple modes to minimize the amount(#days) of logs collected
      • Collects OS level Information,ebfHistory file, csm and few basic system settings
      • Can collect jstacks and the heapdumps

    Usecase / Scenario

    • Collect logs during the jobs failure.
    • Collect the Domain logs during the domain startup failures
    • Collect Domain and services logs whenever the services are failing to start
    • Jobs logs and application logs for specified number of days

    Features

    • Simple to use.
    • A groovy config file is maintained to toggle the log collection options.
    • Groovy file has to be modified and shared with customer based on the logs to be collected

    Usage / Example

    1. Go to INFA_HOME/tools/debugtools/platformlogscollector
    2. Environment Variables - Set the following environment variables
      • export INFA_HOME=/PATH/TO/INFAHOME/
      • setenv INFA_HOME "/PATH/TO/INFAHOME/"
    3. Run command: run.[sh][bat] -m mode -u username -p password -s securitydom

     

    Modes:

     

     

    LITE

    FULL(Default)

    COMPREHENSIVE

    domainLogsDuration

    1

    7

    30

    jobLogsDuration

    1

    7

    7

    JStack

    TRUE

    TRUE

    TRUE

    collectHeap

    FALSE

    FALSE

    TRUE

    OsCommands

    FALSE

    TRUE

    TRUE

    Jstat

    FALSE

    TRUE

    TRUE

    Core Files

    FALSE

    FALSE

    FALSE

     

    Files

    • ./logs Folder contains the Logs related to LogCollector command.
    • ./config/infalogscollectorconfig.groovy (for customizing the logs collection)
    • run.[sh][bat] script to run the LogCollector

    Config file content

    • Configuration file "infalogscollectorconfig.groovy" will be used customize the log collection.
    • File mainly contains below sections(Which can be customized based on the requirement) :
      • defaults {  //For default username,pass, domain and domain and job log duration} 
      • commands { //  InfaDump , infacmd getLog, jstat }
      • mode { // lite , full, comprehensive  values for each modes can be customized here }
      • extensionPatterns {//to copy the file with specific extensions }
      • logFolders { // log Folders to be copied }
      • osCommands {// To collect OS command outputs}

     

    Run run.[bat|sh] confighelp for a detailed help on the config file and what it contains

    Example:

    platformlogscollector config help

    platformlogscollector>.\run.bat confighelp

     

    Reading configuration file = C:\Users\saithal\OneDrive - Informatica\PS_Tools\debugtools_latest\platformlogscollector\configs\infalogscollectorconfig.groovy

     

     

            CONFIG FILE HELP

    ===============================

     

    Generic help text for this config file.

    This is a configuration file defined in the form of Groovy script.

    Help for various sections of this config file are under  "Section: <label>" below.

     

    General format of this configuration file

     

            section {

     

                    subSection {

                            field = value

                            field2 = value2

                            ...

                    }

     

                    subSection {

                            field = value

                            field2 = value2

                            ...

                    }

                    ...

            }

     

    Further reading: http://docs.groovy-lang.org/latest/html/gapi/groovy/util/ConfigSlurper.html

     

    Feedback - @saithal

    Bug - infajira -> GCSTOOLS

     

     

    ============================

    Section: defaults

    ============================

     

    Global defaults are defined in this section.

    Do not remove any of these.

    Except INFA_HOME_ENV and INFA_JDK_HOME_ENV, the values of the rest can be edited.

     

     

    ============================

    Section: overrides

    ============================

     

    Overrides, if any, that will be set at runtime and read by other api's.

    This is for tool's internal use.

    DO NOT EDIT THIS.

     

     

    ============================

    Section: mode

    ============================

     

    This section defines the various modes of operation of this tool.

    A mode has controls and flags that governs the amount of diagnostics that will be generated and the amount of logs gathered.

     

    General format:

     

    modeName {

     

            domainLogsDuration              - (int) domain logs for the last domainLogsDuration days will be collected

            jobLogsDuration                 - (int) job logs ( DIS or PCIS ) for the last jobLogsDuration days will be collected

            collectStack                    - (bool) true|false - flag to control if stack/jstack is collected

            collectHeap                     - (bool) true|false - flag to control if heapdump is collected (applicable only to Java services)

            runOsCommands                   - (bool) true|false - flag to control if operating system commands are run. See 'osCommands' below

            collectJstat                    - (bool) true|false - flag to control if GC stat is collected (applicable only to Java services)

            collectCore                             - (bool) true|false - flag to control if process memory dump is collected using cdb.exe. For windows only. USE WITH CAUTION

    }

     

    modeName        - name of the mode. Current ones are lite, full and comprehensive.

    Global default values of domainLogsDuration and jobLogsDuration are overridden here.

    Define your own section, say customMode, and invoke it via "run.[bat|sh] -m customMode"

     

     

    ============================

    Section: commands

    ============================

     

    A section for all the general commands that will run on services.

    Sub-sections:

    infaDump        - various commands for stack, heap and coredump on both windows and unix flavors

    infacmd         - command to gather domain and service logs (fall back if we cannot get it from the filesystem. See logFolders -> domainLogsDefault/domainLogs

    jstat           - JDK command to collect GC (Garbage collection) activity

     

     

    ----------------------------------

    Section: commands -> infaDump

    ----------------------------------

     

    infaDump commands sub-section.

    By default we collect:

            one heapdump

            "numIterations" of stack/jstack, at an interval of "runInterval" seconds between each run

     

    Unless recommended by GCS, DO NOT MODIFY numIterations and runInterval

     

     

    ...........................................

    Section: commands -> infaDump -> windows

    ...........................................

     

    infaDump sub-section for windows.

     

    There are external utilities needed to gather stacks and/or coredump on Windows.

    Install the "Windows Kits -> Debuggers" on your system to get cdb.exe - which is the command line debugger on Windows.

     

    cdb debugger is usually here C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe

    or also here C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe

     

    Use the appropriate path for the infadump command strings. remember to escape " and \ characters like :

    \"C:\\Program Files (x86)\\Windows Kits\\10\Debuggers\\x64\\cdb.exe\"

     

     

    ----------------------------------

    Section: commands -> infacmd

    ----------------------------------

     

    infacmd commands sub-section.

    General infacmd command strings to gather domain and service logs for a pre-set duration. See  defaults -> domainLogsDuration and mode -> (mode name) -> domainLogsDuration

     

     

    ----------------------------------

    Section: commands -> jstat

    ----------------------------------

     

    jstat commands sub-section.

    JDK jstat command strings to gather Garbage collection (GC) activity on a Java application.

    The command collects GC activity for 5 times at an interval of 2 seconds (hard-coded) on a supplied PID.

    PID comes from pidsForInfaDump section. See pidsForInfaDump below

     

     

    -----------------------------------------

    Section: commands -> lastXDaysFilesCmd

    -----------------------------------------

     

    lastXDaysFilesCmd commands sub-section.

    This section details the commands for the various OS which helps us gather the files created in the last X days.

    The tool uses this command to and gets the OS to do the heavy lifting: gathering the last X days files from a huge folder is time consuming and memory intensive.

     

     

    The command takes two positional parameters:

    {0} - folder to run the file searching

    {1} - duration in days

     

    Unix takes duration arg as-is.

    Windows needs a value in MM/dd/yyyy which is CurrentDate MINUS duration

    The output for both is the ABSOLUTE PATH of the file that fits the query, one in each line. Example

            /path/folder/file1.log

            /path/folder/file2.log

     

    Example commands to fetch last 7 days files, where current date is 10June2020

    unix : find /path/folder1 -mtime -7

    win  : forfiles /P "C:\Path\Folder1" /S /D +06/03/2020

     

    If you need to override this, ensure the following

            1. command should take path and duration

            2. if duration in days is not acceptable, provide a valid Java based calculation of your duration string ( example:  lastXDaysFilesCmd.windows.durationValue).

                    Use the value of overrides.jobLogsDuration to ensure the right value is used for the mode the tool runs in. See 'mode' below.

            3. the command MUST output the absolute path of files, one entry in each line. Basic cleanup like removal of quotes is performed, nothing more.

     

     

    ============================

    Section: extensionPatterns

    ============================

     

    A section that defines the various log file extension patterns.

    Most of the relevant file extensions are covered.

     

    If you want to define your own extension, use the below example and add it to the bottom of the list

    UNIQUE_NAME_PATTERN_MYEXT = ~/.*\.myext/

     

     

    ============================

    Section: logFolders

    ============================

     

    This section defines all the important log folders where files will be fetched from.

    General format:

     

    folderTypeLabel {

            path                    - path for your folder, usually relative to INFA_HOME

            pattern                 - arraylist of extensionPatterns entries denoting the type of file extension patterns to be collected (See extensionPatterns above)

            description             - a nice description for your folderType

            recurse                 - true|false - a flag to control whether the tool recurses into the directories inside your "path". Default is FALSE. Use with caution

            excludedDirs    - list of directories that are excluded from recursive fetch. Used only for nodeLogsDefault folderType

            disabled                - true|false - a flag to indicate if this folderType fetch is disabled or not. Default is FALSE

    }

     

    All of the usual folders under INFA_HOME are already defined.

    Some folderType entries here are special: nodeLogsDefault, disLogsDefault, isLogsDefault, domainLogsDefault and domainLogs.

    This is because we fetch logs from these directories based on a duration flag ( see: mode -> (mode name) -> domainLogsDuration and mode -> (mode name) -> jobLogDuration )

     

    If you need to add a folder here, do it after the "//custom" entry down below in this section

    folderTypeLabel         - use a nice and unique name (without space) for your folder type label

     

    Tip - dont need one or more of these folders? Just comment the entire section or add a field "disabled = true"

     

     

    ============================

    Section: dis

    ============================

     

    This section defines all the custom Log Directory paths of every DataIntegrationService in the domain, on every node.

    This is necessary since the tool does not connect to the Domain to fetch these details.

    Ignore this if your DIS on the current node uses the default log directory INFAHOME/logs/NODENAME/services/DataIntegrationService/disLogs

     

    General format:

     

            DISNAME_1 {

     

                    NodeName_1 {

                            logDirectory = <path>

                            pattern = ..

                    }

     

                    NodeName_2 {

                            logDirectory = <path>

                            pattern = ..

                    }

                    ...

            }

            ...

     

     

    DISNAME_N        - Name of the DIS in your domain

    NodeName_N       - Name of the Node in the domain where DIS runs

    logDirectory - Custom SystemLogsDirectory of DISNAME_N on NodeName_N

    pattern - arraylist of extensionPatterns entries denoting the type of file extension patterns to be collected (See extensionPatterns above)

     

     

    ============================

    Section: pcis

    ============================

     

    This section defines all the custom Log Directory paths of every PowerCenter IntegrationService in the domain, on every node.

    This is necessary since the tool does not connect to the Domain to fetch these details.

    Ignore this if your IntegrationService on the current node uses the default log directory INFAHOME/server/infa_shared

     

    General format:

     

            IS_NAME_1 {

     

                    NodeName_1 {

                            logDirectory = <path>

                            pattern = ..

                    }

     

                    NodeName_2 {

                            logDirectory = <path>

                            pattern = ..

                    }

                    ...

            }

            ...

     

     

    IS_NAME_N        - Name of the PowerCenter IntegrationService in your domain

    NodeName_N       - Name of the Node in the domain where IS runs

    logDirectory - Custom directory for IS_NAME_N on NodeName_N

    pattern - arraylist of extensionPatterns entries denoting the type of file extension patterns to be collected (See extensionPatterns above)

     

     

    ============================

    Section: pidsForInfaDump

    ============================

     

    A section that defines the commands that helps gather the process IDs (PIDs) for infadump and jstat.

    General format:

     

    operatingSystemSection {

            someserviceLabel {

                    getPIDCmd               - command string that fetches a list of PIDs, one in each line

                    disabled                - true|false - flag to control whether to run this section or not, default is FALSE

                    collectHeap             - true|false - flag to control whether to collect heapdump for a Java service, default is mode->collectHeap

            }

    }

     

    operatingSystemSection  - all relevant Operating system sections are defined

    someserviceLabel                - use a nice and unique name (without space) for your custom service

     

    Currently, infadump commands are run serially

     

     

    ============================

    Section: osCommands

    ============================

     

    A section that defines the generic operating system (OS) commands that will be run if mode -> runOsCommands = true

    General format:

     

    operatingsystem_section {

     

            osCommandLabel {

                    command                 - OS command string which sends output to standard output (STDOUT).

                    description             - "description string" - a nice string to describe your OS command

                    disabled                - true|false - flag to control whether to run this section or not, default is FALSE

            }

    }

     

    operatingsystem_section - all relevant Operating system sections are defined

    osCommandLabel                  - use a nice and unique name (without space) for your custom OS command

     

    Each OS command expected to dump the output to standard output (STDOUT).

    The tool gathers this stdout into a unique file.

    Run OS commands with caution!

     

    Currently, OS commands are run serially.

     

    Tip - dont need one or more of these commands? Just comment the entire section or add a field "disabled = true"

     

    Sample Run Output

    [aganta@vento BDM]$ ./run.sh -m lite -u admin-p admin -s Native

    Using INFA_HOME : /data/isuser/IS_02482750_10.75.154.77_10.2.0_HF1_64/10.2.0_HF1/
    Trying alternative INFA_JDK_HOME..
    Setting INFA_JDK_HOME to /data/isuser/IS_02482750_10.75.154.77_10.2.0_HF1_64/10.2.0_HF1//tools/debugtools/java/
    Using default options: -m full -u admin -p admin -s Native
    /data/isuser/IS_02482750_10.75.154.77_10.2.0_HF1_64/10.2.0_HF1//tools/debugtools/java//bin/java -Dmode=full -Dusername=admin -Dpassword=admin -Dsecuritydomain=Native -DconfigFile=./configs/infalogscollectorconfig.groovy -Djava.util.logging.config.file=./configs/logging.properties -jar ./infalogscollector.jar run


    2020-01-23 13:49:08 : INFO : [INFA LOGS COLLECTOR] - start - version 1.0.1 - 20190315
    2020-01-23 13:49:08 : INFO :
    2020-01-23 13:49:08 : INFO : [SETUP ENV] - start
    2020-01-23 13:49:08 : INFO :
    2020-01-23 13:49:08 : INFO : INFA_HOME = /data/isuser/IS_02482750_10.75.154.77_10.2.0_HF1_64/10.2.0_HF1/
    2020-01-23 13:49:09 : INFO : NODE NAME (from nodemeta.xml) = N_02482750
    2020-01-23 13:49:09 : INFO : DOMAIN NAME (from nodemeta.xml) = D_02482750_SP
    2020-01-23 13:49:09 : INFO : DEFAULT_NODELOGS_PATH = /data/isuser/IS_02482750_10.75.154.77_10.2.0_HF1_64/10.2.0_HF1//logs/N_02482750
    2020-01-23 13:49:09 : INFO :
    2020-01-23 13:49:09 : INFO : [SETUP ENV] - end
    2020-01-23 13:49:09 : INFO :
    2020-01-23 13:49:09 : INFO : [READING CONFIG FILE]
    2020-01-23 13:49:09 : INFO : LOGS COLLECTOR CONFIGURATION FILE = ./configs/infalogscollectorconfig.groovy
    2020-01-23 13:49:10 : INFO :
    2020-01-23 13:49:10 : INFO : [RUN MODE] - full
    2020-01-23 13:49:10 : INFO :
    2020-01-23 13:49:10 : INFO : OUTPUT FOLDER = /tmp
    2020-01-23 13:49:10 : INFO :
    2020-01-23 13:49:10 : INFO : [GETTING LOGS FROM FILE SYSTEM FOLDERS]

    Files (Runnable & Source Code)