Problem/Symptoms
Geocortex Analytics cannot read log files with UNC paths over 260 characters.
When trying to configure your Geocortex Analytics agent to collect ArcGIS Server logs from a file path longer than 260 characters you receive a 'PathTooLongException' error such as the one below:
[2018-05-04 00:14:51,060][ERROR][34 ][Analytics.ResourceCollector][Geocortex.Analytics.Infrastructure.Collection.Pipeline.Phase.PhasePipelineWorker.GenerateAbnormalEvent] Exception Occurred: 'Exception from a job' details: PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. at System.IO.PathHelper.GetFullPathName() at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.GetFullPathInternal(String path) at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath) at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath) at System.IO.FileSystemInfo.get_FullName() at Geocortex.Analytics.Infrastructure.Collection.Jobs.ArcGisServerLogCrawlJobBase.PrepareFilesInLogDirectoryForCollection(String logsDirectory) at Geocortex.Analytics.Infrastructure.Collection.Jobs.ArcGisServerLogCrawlJobBase.ConcreteExecute(ICycleActionable cycleActionable, CancellationToken cancellationToken) at Geocortex.Analytics.Infrastructure.Collection.Jobs.ArcGisServerLogCrawlJob.ConcreteExecute(ICycleActionable cycleActionable, CancellationToken cancellationToken) at Geocortex.Analytics.Infrastructure.Collection.Jobs.ResourceJobBase.Execute(ICycleActionable cycleActionable, CancellationToken cancellationToken) at Geocortex.Analytics.Infrastructure.Collection.Pipeline.Phase.PhasePipelineWorker.<>c__DisplayClass13_0.<Execute>b__0() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Geocortex.Analytics.Infrastructure.Collection.Pipeline.Phase.PhasePipelineWorker.<>c__DisplayClass13_0.<Execute>b__0() at System.Threading.Tasks.Parallel.<>c__DisplayClass4_0.<Invoke>b__0()
Cause
This issue is caused by a limitation of the Windows platform. The Windows APIs have a defined file path limit known as MAX_PATH which is 260 characters. This is based on legacy technical limitations around available memory and maintaining backwards compatibility with old applications.
A long network share name, combined with the length of ArcGIS Server log file names, can end up over 260 characters.
For example:
C:\arcgisserver\logs turns into \\server_with_a_very_very_long_name\network_share_that_also_has_a_very_long_name, adding 50 characters. When addressing a specific log file, the path might end up something like "\\server_with_a_long_name.really_long_domain_name_company.co.uk\network_share_that_also_has_a_very_long_name\server_with_a_long_name\server_with_a_long_name\server_with_a_long_name-20170908.124637-15228-0.3.txt" is 210 characters. With the level of detail in some server & network shares it is easy to imagine a fully qualified network path hitting that 260 character limit.
Further reading
Microsoft Documentation on Maximum Path Length Limitation
Solution:
It is possible to workaround this issue in a few different ways:
- Using an Agent install so the log files are accessed via local path
- Changing the network share name to have fewer characters than the local path
- Going one folder deeper for the network share (i.e. C:\arcgisserver\logs\HOST.DOMAIN.COM)
Comments
0 comments
Article is closed for comments.