Email parsing in Security Operations turns alert emails from your detection tools into Security Operations records, such as security incidents or vulnerability records. You build the parser from the Email Parsing list, set its filters, then add field transforms that copy values from each email into record fields. Creating parsers requires the sn_sec_cmn.admin role.
Set up the mail flow and user account first
Most of the groundwork happens before you open the parser form. Confirm these items first, because each one affects whether a parser can match an email at all.
- Send each detection tool’s alert emails to one central email address.
- Enter that address in the Security Operations properties.
- Assign a user account to the address, with the security access controls needed to create and update email event records.
- Keep a copy of a representative email from each tool open, because you will match its exact wording.
- Decide which record type each email should produce. That choice sets the destination table, and the table sets which fields you can fill.
Note whether each value you need sits at the start of a line, somewhere in the body or in the subject line. Those notes decide the search options you set later.
If you are new to the application, read the plain-language guide to ServiceNow Security Operations before you choose a record type. For a wider rollout plan, see the implementation roadmap.
For help planning this work, see ServiceNow implementation.
Create the email parser record in four steps
The parser decides which emails it handles and which table receives the records it creates. Your user needs the sn_sec_cmn.admin role to open the form.
- Go to All, then Security Operations, then Email Parsing.
- Select New.
- Fill in the fields that apply to your emails.
- Select and hold (or right-click) in the form header, then select Save. A Field Transforms tab appears after the save.
Each field has a specific job:
- Name identifies the parser. Include the tool and the alert type it handles.
- Email is from limits the parser to emails sent from the address you enter.
- Email is to limits the parser to emails addressed to the address you enter.
- Email subject contains limits the parser to emails whose subject includes the phrase you enter.
- Duplication rule sets how duplicate emails are handled.
- Order sets the sequence in which parsers are considered. The default is 100.
- Destination table is the table where records are created.
- Active switches the parser on. When it is cleared, the parser transforms no emails.
- Record Separator holds the text that divides one email into several records.
- Description records which tool the parser works with and its purpose.
Map each value with field transforms
A field transform copies one value from the email into one field, or links that value to a related list. Build one for each value you need, using New on the Field Transforms tab.
Choose where each value is stored
- Store value in a field or a related list offers three choices: store the value in a field on the new record, link to the value in a related list, or link to the value and create a new related record when no match exists.
- Field names the field that receives the value. A choice field matches existing choices by label or value, and if nothing matches, the field is set but no new choice is added. A reference field receives the value only when it matches the display name of a record or a valid sys_id.
- Related list and Value field work as a pair. The first names the list that receives the link, such as Affected CIs. The second names the field the parser uses to find an existing record, such as Name or Fully Qualified Domain Name.
- Relationship data adds field and value pairs to the linking record, separated by a caret, as in type=Source IP^Active=true. Use it to mark an IP address as the source rather than the destination.
- New record data sets static values on a record the parser creates when no match exists.
Set where the parser searches and where each value ends
Search for value controls the part of the email that gets searched. The choices are At the start of a line in the email body, Anywhere in the email body, In the email subject line, and Always the static value.
Value prefix is the text immediately before the value. End of value offers End of line, End of email, which brings in all the remaining text, and Until, which stops at the text you enter in Value suffix. Value separator names the character that divides a list of items, such as comma-separated IP addresses.
Suppose the body contains the words Device ID, followed by a number and then a status note. Set Value prefix to Device ID, set End of value to Until, and set Value suffix to the character that follows the number. Check whether the prefix needs a trailing space so the capture starts at the right character.
Set the order of field transforms and switch them on
- Value transform converts the text from the email into the value the field needs, which matters most for choice fields.
- Order runs from lowest to highest. A field transform at 100 is tried first. A second field transform on the same field, at 200, runs if the first finds no value.
- Active is checked by default. Clear it to switch off that field transform.
When the entries are complete, select Submit.
Parse emails that create several records
Some detection tools place several alerts in one email, with shared information above the individual sections. Set Record Separator to the text that divides those sections. Search for value then also offers Anywhere within the record section and At the start of a line within the record section, which limit the search to the section holding the current record. Header and footer information that applies to all records is still searched across the whole body. Test with an email of at least two sections, because a separator repeated in a footer or a quoted reply can split the email in the wrong place.
Set matching order and duplicate handling
Parsers are considered in Order, and the first matching parser is used. Put the most specific parsers at the lower numbers, and give catch-all parsers higher numbers so they run if nothing else matches. When the from, to and subject filters all match an email, the most specific parser is the one used.
If you fill in more than one filter, the email must match all of them before a record is created. A parser that filters on subject alone will pick up any email carrying that phrase, including mail you did not intend to parse. Test the phrase against real mail from the tool and against unrelated mail from the same sender.
The Duplication rule governs how repeated emails are handled. Duplication rules are a separate setup task in Security Operations, so define them before you switch the parser on. For day-to-day guidance, see Security Operations best practices.
Test the parser before you rely on it
Test with real messages, not only the copy you built the parser from. Work through this sequence:
- Send one sample email from the detection tool to the central address.
- Compare each field on the new record with the matching line in the email.
- Check each related list you linked, and confirm the lookup found the right existing record or created the expected new one.
- Send the same email again, and check how the duplication rule handled it.
- Send an email that should not match, and confirm this parser creates no record from it.
Menu labels, field names and form layout can differ between releases, so confirm each name on your instance before you copy a value from this page. For problems that appear after go-live, see common Security Operations mistakes.
Questions about email parser setup and matching
Why does an email that looks like a match skip the parser?
Compare the sender address and the subject phrase character by character with the original email, because a difference in punctuation or spacing is enough to stop a match. Confirm the parser is active, and check whether a parser with a lower Order number matches the email first.
Should each detection tool have its own parser?
Usually, yes. Each tool lays out its emails differently, and a field transform built for one layout can miss values in another. Separate parsers also let you change one tool’s mapping without touching the others.
Can one parser create two different types of record?
A parser has one Destination table, so it creates records in one table. If emails from the same tool need different record types, use the from, to and subject filters to send each type to its own parser.
How should I change a parser that is already in use?
Clear the Active check box, make your changes, send a sample email through the test sequence, and then select Active again. Record what changed in the Description field so the next person can see what the parser was built to do.
Why does a value come through blank or land in the wrong field?
Forwarded emails often change line breaks, wrap long lines or add quoted text, and those changes move the values that an At the start of a line search depends on. Compare the original email from the tool with your Search for value setting, and check End of value when a value runs into the line below it.