FAQ: Creating many profiles in a batch
How can I create many profiles in a batch, from a template?
Short Answer
Use the create_many_profiles
command-line option.
Long Answer
To create many profiles in a batch, all based on a particular "template" profile, you can use the
create_many_profiles
command-line feature. To do that, start by editing the file
LogAnalysisInfo/miscellaneous/create_many_profiles.cfg file, using a text editor. Do the following:
Change
template_profile_name
to the internal name of the profile you want to use as a template. The internal name is the name of the file in LogAnalysisInfo/profiles, but without the .cfg extension, so this might be:template_profile_name = "my_profile"
Change "
clone1 = {
" to the internal name of the first profile, the one you want to create:derived_profile_1 = {
Change the label to the "human readable" name of the profile, e.g.:
label = "Derived Profile 1"
Make changes inside the
changes
section of theclone1
group, to change any options that you want changed in the profile (whatever should be different from the template profile). One common change is the log source pathname; the following line changes the "pathname" option in the "0" group of the "source" group of the "log" group of the profile .cfg file; i.e., it changes the pathname of log source 0 (which is typically the first log source), so it looks for its log data in /logs/for/clone1:log.source.0.pathname = "/logs/for/clone1"
Another common change is to add a filter to reject all but a certain class of events, in this profile's database; for instance, this rejects all hits in IIS logs where the page doesn't start with "/abc", resulting in a profile showing only hits on the "abc" directory of the web site:
log.filters.2 = "if (!starts_with(cs_uri_stem, '/abc')) then 'reject';"
Repeat this for as many profiles as you need, by duplicating the
clone1
section for each profile, choosing a new internal name (replacingclone1
) and label (replacing "Clone 1") for each new profile.Run Sawmill from the command line, for Windows:
Sawmill.exe -dp util.create_many_profiles
or the following command line, for non-Windows:
sawmill -dp util.create_many_profiles
This step will create all profiles.
At any time, you can recreate all profiles without affecting their databases. So by editing only the template profile, and using
create_many_profiles
to propagate changes to all clones, you can maintain all profiles with only one template profile.