How do I monitor the usage of license keys for MATLAB and toolboxes?

I would like to monitor the usage (number of users) of license keys for MATLAB and other MathWorks products.

 Accepted Answer

If you have a network license, there are several ways to monitor license usage:
  • Flexera Software
  • LMSTAT
  • Log File

Flexera Software (Not Provided by MathWorks)

This article addresses how to monitor license usage in real time, intended for troubleshooting purposes only. If you are looking to monitor long-term usage instead, Flexera Software offers FlexNet Manager, which is software used for tracking and monitoring license usage. 
For more information, please visit Flexera's website:

LMSTAT

To check current license usage, you can use the lmstat function 
The lmstat function will display the following information:
  • Username of person that checked out the license.
  • Hostname of computer that the license was checked out on.
  • Date and time that license was checked out.
To use the lmstat function, open Terminal and run the following commands.
Linux:
cd $MATLABROOT/etc/glnxa64./lmutil lmstat -a
MacOS:
cd $MATLAB/etc/maci64
./lmutil lmstat -a
Windows:
  1. Open the folder $MATLABROOT\etc\win64
  2. Run "lmtools.exe".
  3. Go to the "Server Status" tab.
  4. Click on "Perform Status Enquiry".
Alternatively, you can open Command Prompt and run the following commands.
cd $MATLABROOT\etc\win64lmutil lmstat -c license.dat -a
By default, $MATLABROOT = C:\Program Files\MATLAB\R20XXx
If you cannot find the above directories, you may not be on the license server. Please refer to following support article:Is there a way for licenses to be monitored from the client machine instead of the server?
For more information about lmtools and lmstat, please see the following documentation:

Log File

For a long-term record of license usage, view the license manager log file.
By default, every time the license manager is restarted, the log file gets overwritten. To append entries to the log file rather than overwrite them, please follow the instructions from the link below:
 
The network license manager log file will show license check-ins and check-outs:
  • When someone starts using a product, it checks out a key.
  • When someone stops using a product, it checks the key back in
The following are the default locations for each supported operating system:
Linux:
/var/tmp/lm_TMW.log
MacOS:
/var/tmp/lm_TMW.log
Windows:
$MATLABROOT\etc\lmlog.txt
You can also view the log file on Windows in lmtools.exe.
  1. Go to "Config Services" tab.
  2. Click on "View Log".
The log will be displayed in a pop-up window.
Example of lmlog.txt:
13:11:03 (lmgrd) -----------------------------------------------
13:11:03 (lmgrd) Please Note:
13:11:03 (lmgrd)
13:11:03 (lmgrd) This log is intended for debug purposes only.
13:11:03 (lmgrd) In order to capture accurate license
13:11:03 (lmgrd) usage data into an organized repository,
13:11:03 (lmgrd) please enable report logging. Use Flexera's
13:11:03 (lmgrd) software license administration solution,
13:11:03 (lmgrd) FlexNet Manager, to readily gain visibility
13:11:03 (lmgrd) into license usage data and to create
13:11:03 (lmgrd) insightful reports on critical information like
13:11:03 (lmgrd) license availability and usage. FlexNet Manager
13:11:03 (lmgrd) can be fully automated to run these reports on
13:11:03 (lmgrd) schedule and can be used to track license
13:11:03 (lmgrd) servers and usage across a heterogeneous
13:11:03 (lmgrd) network of servers including Windows NT, Linux
13:11:03 (lmgrd) and UNIX.
13:11:03 (lmgrd)
13:11:03 (lmgrd) -----------------------------------------------
13:11:03 (lmgrd)
13:11:03 (lmgrd)
13:11:03 (lmgrd) Server's System Date and Time: Tue Jul 28 2026 13:11:03 Eastern Daylight Time
13:11:03 (lmgrd) pid 5748
13:11:03 (lmgrd) Changing message security level from -1 to 0
13:11:03 (lmgrd) SLOG: Summary LOG statistics is enabled.
13:11:03 (lmgrd) Done rereading
13:11:03 (lmgrd) FlexNet Licensing (v11.19.7.0 build 294770 x64_n6) started on MW-PF3ZKSE7 (IBM PC) (7/28/2026)
13:11:03 (lmgrd) Copyright (c) 1988-2024 Flexera. All Rights Reserved.
13:11:03 (lmgrd) World Wide Web: http://www.flexerasoftware.com
13:11:03 (lmgrd) License file(s): C:\Program Files\MATLAB\R2026a\etc\license.dat
13:11:03 (lmgrd) lmgrd tcp-port 27000
13:11:03 (lmgrd) (@lmgrd-SLOG@) ===============================================
13:11:03 (lmgrd) (@lmgrd-SLOG@) === LMGRD ===
13:11:03 (lmgrd) (@lmgrd-SLOG@) Start-Date: Tue Jul 28 2026 13:11:03 Eastern Daylight Time
13:11:03 (lmgrd) (@lmgrd-SLOG@) PID: 5748
13:11:03 (lmgrd) (@lmgrd-SLOG@) LMGRD Version: v11.19.7.0 build 294770 x64_n6 ( build 294770 (ipv6))
13:11:03 (lmgrd) (@lmgrd-SLOG@)
13:11:03 (lmgrd) (@lmgrd-SLOG@) === Network Info ===
13:11:03 (lmgrd) (@lmgrd-SLOG@) Listening port: 27000
13:11:03 (lmgrd) (@lmgrd-SLOG@)
13:11:03 (lmgrd) (@lmgrd-SLOG@) === Startup Info ===
13:11:03 (lmgrd) (@lmgrd-SLOG@) Is LS run as a service: Yes
13:11:03 (lmgrd) (@lmgrd-SLOG@) Server Configuration: Single Server
13:11:03 (lmgrd) (@lmgrd-SLOG@) Command-line options used at LS startup: -c C:\Program Files\MATLAB\R2026a\etc\license.dat -l C:\Program Files\MATLAB\R2025b\etc\win64\lmlog.txt -z -s
13:11:03 (lmgrd) (@lmgrd-SLOG@) License file(s) used: C:\Program Files\MATLAB\R2026a\etc\license.dat
13:11:03 (lmgrd) (@lmgrd-SLOG@) ===============================================
13:11:03 (lmgrd) SLOG: FNPLS-INTERNAL-VL1-40000
13:11:03 (lmgrd) Starting vendor daemons ...
13:11:03 (lmgrd) Started MLM (pid 29472)
13:11:03 (MLM) Listener Thread: running
13:11:23 (MLM) OUT: "MATLAB" jsmith@license_server
13:11:23 (MLM) AUXINFO: [locale=en_US],[location=840],[user=bgould]
13:12:02 (MLM) IN: "MATLAB" jsmith@license_server
This logfile indicates that the user jsmith checked out a MATLAB key from the server license_server at 13:11 and that it was returned at 13:12 when he exited MATLAB. 

6 Comments

Historically speaking, I used to find the license logging a bit fragile. In the case of MATLAB crashing, or even just the user closing the terminal session without logging out, the return of the keys did not always get logged.
Could you elaborate on "Used to"? Is it better now?
In my experience, a dirty exit (matlab crash) has actually kept the keys checked out, and prevented others from being able to get a key - slightly different from an unlogged return.
I have not administered a license server for over 7 years, so I do not know if it has improved.
How do i get average number of users over a period of time?
Back when I administered a license server, the logging tools provided with FlexLM were not good at statistics, and it was understood that if you needed real statistics that you needed to buy a third party monitoring package.
In that situation, you are going to need to write software to parse the license logs yourself, or else you are going to need to purchase flexera license monitoring software. The flexera license monitoring software that Flexera makes available is limited to showing what licenses are currently in use and who is using them, and is completely incapable of providing any kind of historical information.
It might possibly be the case that Flexera has improved their logs since the days when they were called FlexLM and I dealt with their logs. Back when I was dealing with their logs, the logs lost track of information. It was necessary to analyze carefully to look for signs of a license manager restart, to know to flush any information you had accumulated about who has which license checked out. It was also necessary to compare keys closely to notice that the same person was checking out the exact same license key -- implying that at some point between that they must have released the license key even though it did not get logged.
Back then, in order to get reliable analysis, third party companies provided software that effectively intercepted calls between the master license daemon and the MATLAB license daemon, and maintained their own information database. It was a luxary that we could not afford, so I did the best I could with using perl or somethng like that to analyze the logs (and correlate against system reboots, and things like that...)

Sign in to comment.

More Answers (0)

Categories

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!