Parameterizing filenames for SA/custom attributes

When you create a file rule in an audit or snapshot specification, you can also reference environment variables and custom attributes in the file name. In the File/Directory Wildcard area of the rule window, you can edit the file name to add these references.

To add a reference to a Windows environment variable, the syntax is %envVarName% and for Unix, the syntax is ${varName}.

The syntax for specifying custom attributes is @varName@. For example:

@/customattribute/custAttrbuteNAME@\rest\of\the\path
@/customattribute/FacilityCustomAttrbuteNAME@\rest\of\the\path
@/customattribute/CustomerCustomAttributeNAME@\rest\of\the\path
@/customattribute/ServerAttrbuteNAME@\rest\of\the\path
@/customattribute/GrpAttrbuteNAME@\rest\of\the\path

This allows for auditing relative paths on both source and target servers using a parameterized environment variable or custom attribute in the filename.

Examples of parameterizing filenames

For example, on the servers you want to audit you know the relative path to an application, but not necessarily the absolute path for all servers. You can parameterize the path in your audit’s File rule so the relative pathname is eliminated and the auditchecks the relative path anywhere it exists on the target server.

For example, you want to audit a target servers against a golden source server where '%ProgramFiles%' is :\Program Files” against target servers where %ProgramFiles% is D:\Program Files.

In the File/Directory Wildcard section of the File rule, you can specify the root of the directory rule in the audit to be %ProgramFiles%\Company\MyApp. The audit will remove %ProgramFiles% from the paths of the servers it targets when you run the audit. In other words, C:\Program Files\Company\MyApp\file1.txt on the source server will be compared with D:\Program Files\Company\MyApp\file1.txt on the target servers.

In another example, you may want to audit an application that is installed into two completely different subdirectories on two different servers.

For example, in your audit you choose from a golden source server configuration the installation path of the following:

/usr/local/app-version-1232/prog

And, your target servers have the application installed anywhere under this path:

/usr/local/app

In order to audit the target server, you can defines a custom attribute APP_INSTALL_LOC with a value of /usr/local/app-version-1232/prog for the golden server and
/usr/local/app for the production servers. The File rule in the audit would look something like this:

@/customattribute/APP_INSTALL_LOC@/prog

This would cause the audit to treat @/opsware/customattribute/APP_INSTALL_LOC@ as if it were an environment variable on the target server and do a path replacement.

If you wanted to reference a server attribute, the path would be entered like this: @/server/APP_INSTALL_LOC@/prog