Skip to main content

Back-End Development

Analyzing TM1 logs and data from the command line using Find

Application security assessment

The Find Command

I come from a systems background in Windows and Linux, maintaining operations and writing programs in C.  Since I bring that perspective to my TM1 work, I’m more comfortable with command line tools than some of my other teammates, so I thought I would share some tips.

As an example, let’s look at a large file of actuals.  A customer’s file is over 1GB in size and has over six million rows, but Excel can only load one million rows.  The file is also too large to be loaded into Notepad++ or other common tools.  To research an issue with this file, I probably only need a small number of records that affect a particular cost center or model number.

With a command like:

find “HOU00884500” actuals.txt >smallfile.txt

I can reduce my large file of actuals down to 414 lines in about two minutes, and then use another tool such as Excel to analyze the results (smallfile.txt).

Example

Here is a more detailed example. The Find command can be used in Windows Command Prompt or Powershell. I’ll use the command prompt window for this example.

Start the Windows Command Prompt.  One way to do this is to click on the search magnifying glass on the task bar and type in “cmd” (without the quotes) and hit <Enter>.

  • The default directory will normally be a directory you have write access to, such as “C:\USERS\KPORTER” but you may need to switch to a different drive and path.
  • To switch to a different drive, such as the F: drive, just enter the drive letter and : and press <Enter>.
  • To go to a particular path, use the CD (change directory) command, such as “CD \SOURCEDATA\EXAMPLE”.  The target directory must already exist or you will get an error.

Running the Find

Now build the command:

find “HOU00884500” actuals.txt >smallfile.txt

In place of the filename actuals.txt, you can drag a file from a Windows Explorer window onto the command prompt window.  This will insert the full path of the file, so it may look like (bold added for emphasis):

find “HOU00884500” C:\DATADIR\actuals.txt

This command will display the results to the screen.  If you want to capture the results in a file to view them in an editor or Excel, use the > command to redirect to another file.  This file will be created in your current directory if you don’t specify otherwise:

find “HOU00884500” C:\DATADIR\actuals.txt > smallfile.txt

When searching TM1 log files, you may have a ” (quote) character that needs to be included in your actual search string.  To do this, make any ” character that is part of the search string a double quote, “”.  This example will search all the events where the Load Data process completed successfully so you can compare execution times over the timespan of the log:

find “Process “”Load Data””: finished” C:\SERVER\Logs\tm1server.log

Wrapping Up

As you can see, there is a lot of flexibility with the tool, but some uses of it can get pretty complicated.  Don’t be intimidated, though. You can get a lot of value from even just these simple uses.

Let me know in the comments if you have any questions or suggestions.  Is there a similar tool available in the Windows GUI?  I know how to search, but I haven’t seen a comparable way to capture the results.

 

Tags

Thoughts on “Analyzing TM1 logs and data from the command line using Find”

  1. Hi Kevin, Thanks for this useful information.
    I have tried to perform the same action and i replicated the similar example you mentioned here in the article and tried with tm1logs as well, but receiving the below error.

    Error:
    find: HOU00884500: No such file or directory

  2. Kevin Porter Post author

    Hi, good question. The search argument for find always has to be in quotation marks, otherwise it will think that argument is the filename to search. So try:

    find “HOU00884500” …

    – Kevin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Kevin Porter

Kevin Porter has been consulting and cheerleading for TM1 for over a decade, much of that time with Perficient. He loves solving problems and exploring new tools and capabilities.

More from this Author

Follow Us