Use industry standards for log files

486
3
07-11-2017 10:07 PM
Status: Open
BrianWilson
Occasional Contributor II

On Linux systems, you should put log files under /var/log and use consistent naming.

Each of the components in ArcGIS Enterprise seems to keep its logs in a different place; Portal is the worst so far from what I have looked at; the log files are buried in a folder named after the host, and the active log file has a long name with seemingly random characters embedded in it (possibly including the process id?)

Furthermore, you allow the location to be changed in API calls.

The net result is that when I start a copy of Portal running, I have to search out the new log file.

So for example, Portal could always log to /var/log/arcgis/portal.log instead of

/home/arcgis/portal/usr/arcgisportal/logs/PORTAL.ARCGIS.NET/portal/portal-20170712.044717-23025-0.0.log

3 Comments
JonathanQuinn

I can at least comment on the naming convention:

portal-20170712.044717-23025-0.0.log

The blue characters are the date that the log file was created and the orange-ish characters are the time it was created.  Not too sure what the purple-ish characters are indicating but the last are used as an index in case there are multiple log files for a given day as new log files are generated after about 10 MB.

KennethOGuinn

I can appreciate the idea of having /var/log be the location for saved logs.

One reason the logs are not saved to /var/log is the Enterprise products do not run under root by design.

Since most Linux distro's default only allow root to write to that location, the account running portal wouldn't necessarily have write access to that location. As a result the logs are saved in a subfolder of the install location where it can be assured the the software has the correct permissions.

I haven't tried it myself, but maybe a symlink from the portal log location into a /var/log/portal or something similar might do the trick?

BrianWilson

It's pretty standard to create a subdirectory, for example tomcat, nginx, apache, postgresql and mysql all do it that way.

There is always a /var/log folder so the installer just puts the subdirectory there and sets the ownership and permissions appropriately. 

It's easier to set up log rotation if the logs are in a normal place, too. ESRI's installer should set up log rotation using standard tools too.

It's also the expectation when managing a system that if you install files into /home/portal for example that it won't fill up /home with log files and crash your server. So using a symlink won't meet that expectation; /home will still fill up even though it appears that logs are in /var/log.

Brian