You can change and assign specific script separators to
one or more attributes.
When you create a script attribute group, a single character
text separator is by default assigned. The default separator is ";".
The separator is used by the agent to parse and delimit the data for
each attribute in the data row. You can change the default separator
to use a different character. You can also assign specific separators
to one or more individual attributes.
You can assign specific separators for individual attributes
that:
Take a fixed number of bytes from the output.
Separate one attribute from the next with a custom separator,
which can be more than one character.
Delimit an attribute value with a string at the beginning and
end of the value.
Return the rest of the text as the attribute value (whether it
contains embedded separators or not).
You can use one or more of these separators to extract attribute
values from the data rows.
Example 1 - Simple script
output
Some scripts can output data rows with clear and
regular separators, for example:
Row One;1;2
Row Two;3;4
Row Three;5;6
Here the ";" character is
a clear and regular separator between the three pieces of data on
each row. In this case, the default separator is fine, so there is
no need to change or define other separators. It is not difficult
to imagine a similar script output where the separator is a different
character, as in the following example.
Row One-1-2
Row Two-3-4
Row Three-5-6
In this example the separator is changed
from a ";" character to a "-" character.
In this case when you define the attributes, change the default separator
to use the "-" character.
Example 2 - Complex script output
Some scripts
can output data rows that have irregular or changing separators, for
example:
Row One;1;2;[option]Hour:MIN;fourtabby The end;4
Row Two;3;4;[required]12:30;fourvery tabby the tail;5
Row Three;5;6;[out]March:12;fourline up the rest of the story;6
In
this example an assignment of separators to attribute definitions
that you can use is:
Initially the default separator ";" is fine for
the first three attributes in each data row. In this case, you assign
the separator type Separator Text set
to ";" when you define each attribute, this setting
is the default one.
For the fourth attribute, assume the string between the"[" and "]" is
a value that you want to extract. In this case when you define the
fourth attribute, you assign a separator type Begin
and End Text with begin and end text values of "[" and "]".
For the fifth attribute, assume that you want to extract the values
between the "]" and ":" characters.
In this case when you define the fifth attribute, you assign separator
type Separator Text set to ":".
For the sixth attribute, the default separator ";" is
fine again, accept the default.
For the seventh attribute, you would like to extract the string
in the next four characters "four". There is not
a clear separator at the end of this string. You can assign a number
of characters to define the separation from the next attribute. You
assign a separator type Number of characters,
and specify four characters as the length.
For the eighth attribute you would like to extract the strings tabby, very
tabby and line up. In this case, you can
assume that all of these strings are followed by a tab character.
In this case, you assign a separator of type Tab
separator.
For the ninth attribute, you revert again to the default separator
type to extract the remaining text to this attribute.
For the 10th attribute, you specify Remainder
of record to assign the remainder of the data row to this
attribute
Defining these separators on a script that outputs the data rows
that are shown earlier in this example is shown in the following output: Figure 1. Example attribute value
output when Agent parses complex script output.