Splunk Search

multiline match for same pattern


How do i capture all the product name when the number of ProductName elements is variable? And not sure how to assign the group capture to a named variable when you have 0 or more ProductNames.

index=xyz sourcetype=abc |rex "(?s)<ProductName>(?P<product_sku>\w+)</ProductName>" captures one occurence.

0 Karma

Ultra Champion

Have you looked at MV_ADD=true in order to get more than the last value?

Basically, you need to do the following changes/additions on your search head, or on your indexer if you don't have a dedicated search head;

in props.conf

REPORT-gimme_codes = prod_code_extraction

in transforms.conf

REGEX = <ProductName>([^<]+)<
FORMAT = product_sku::$1
MV_ADD = True

Hope this helps,


0 Karma