EcoSys Log Analysis from Command Line - EcoSys - Administration & Configuration - Hexagon

EcoSys System Administration

Language
English
Product
EcoSys
Search by Category
Administration & Configuration
EcoSys Version
8.8

Why use the Log Analyzer?

The Log Analyzer utility enables you to generate Excel log analysis files from text log files. The Excel analysis creates multiple worksheets that separate each type of information. You can run the Log Analyzer against the latest two log files directly from the EcoSys user interface. You can also run the utility from the command line using EcoSys batch to generate a log analysis for a specific file or for multiple files.

Run a log analysis from the command line

Running the Log Analyzer from the command line is a convenient way to analyze EcoSys log files without installing EcoSys or independently of the application server container.

  1. In the EcoSys distribution package, locate the batch\lib folder, and copy it to a separate folder on your target machine/server.

  2. Copy the following files from ESFM_HOME to parent folder of lib folder. For example, batch folder which is immediate parent of lib folder.

    • FMServerSettings.properties

    • log4j.properties

    • FMLicense.properties

  3. Navigate to batch folder > FMServerSettings.properties file, locate the section Database Connection Pool and add a pound (#) symbol in front of the following line to comment it:

    fm.datasource.factory=com.ecosysmgmt.framework.context.JNDIDatasourceFactory

  4. Navigate to batch folder > FMServerSettings.properties file, locate the section Batch Job Connection Pool. Remove the pound (#) symbol to uncomment the following lines. Edit the values if needed.

    fm.datasource.factory=com.ecosysmgmt.framework.context.FMPooledDataSourceFactory

    connectionPool.minSize=2

    connectionPool.maxSize=20

    datasource.JDBCUser=fmuser

    datasource.JDBCPass=fmuser

    datasource.JDBCDriver=oracle.jdbc.OracleDriver

    datasource.JDBCConnectString=jdbc:oracle:thin:@MYSERVERHOSTNAME:1521:ESFM

    If you are using SQL server, ignore the above two Oracle specific lines commented and uncomment the SQL Driver and Connect string as shown below

    datasource.JDBCDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver

    datasource.JDBCConnectString=jdbc:sqlserver://MYSERVERHOSTNAME:1433;database=esfm

  5. Edit the log4j.properties, and change value of "log4j.appender.FILE.File" to point to a location under your batch folder. For example, "LogAnalyzer.log"

  6. Create a new properties file named LogAnalyzer.properties in lib folder, and include the details as follows:

    inputfilename=C:/EcoSys/log/ESFM-Application.log

    outputfilename= C:/EcoSys/log/ESFM-Application-Log-Analysis.xls

    notes=Your Notes Here

    environment=Your Environment

    • Modify the properties with the appropriate file and folder names. Use forward slash (/) as the file separator.

    • Make a note of the complete path of the properties file.

  7. Open a command prompt, and navigate to the folder in which you copied the contents of the batch\lib folder. For example cd C:\EcoSys\batch\lib.

  8. Run the following command: java -classpath * -DESFM_HOME=C:\EcoSys\batch com.ecosysmgmt.fm.util.LogAnalyzer LogAnalyzer.properties

    The default heap size for any java application is 256 MB. When analyzing a large log file, configure minimum and maximum heap size appropriately:

    java –Xms1024m –Xmx1024m-classpath * -DESFM_HOME=C:\EcoSys\batch com.ecosysmgmt.fm.util.LogAnalyzer LogAnalyzer.properties

  9. After the analysis is complete, the software creates the Excel log file and saves it in the folder specified in the outputfilename property.

  10. The software updates the LogAnalyzer.properties file with the metrics data captured during the log analysis.

  11. To generate a log analysis for another file, modify the inputfilename, outputfilename, notes, and environment properties that you defined in Step 2 with the appropriate file and folder names. All other entries in the properties file are automatically updated every time you run a log analysis.

How to merge multiple files

Running the Log Analyzer from the command line can generate the Excel analysis file using a single text file as input. To analyze multiple log files, you must merge all the files into a single log file.

Ensure that you merge the files in the correct order so that the timestamps of the log activity remain in order. Otherwise, the Log Analyzer may show data incorrectly.

The following command can be helpful in creating a single log file from multiple log files. The file names must be in the reverse order of creation. For example, the last log file created should be first in the list of files to be copied. To merge files from a command prompt:

  1. Open a command prompt.

  2. Navigate to the folder in which the raw log files are saved. An example command to merge four log files into one is shown below.

    copy /b ESFM-Application.log.3+ESFM-Application.log.2+ESFM-Application.log.1+ESFM-Application.log ALL_Logs.log

  • Yellow highlighted text indicates the command to copy multiple files in binary mode.

  • Green highlighted text indicates the list of files to be merged. This is where it is important to maintain the correct order of the files.

  • Blue highlighted text indicates the name of the merged file to which all the contents will be copied.