- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sarit_s
Communicator
04-02-2019
12:38 AM
Hello,
I have an event that looks like :
> <18> 20/02/19 22:23:59 : Maintenance counter "Digital Materials Mode" Value is: 84 hours.
i need to extract the Maintenance counter type (the string between ""), the value and the value type (in the example its hours, can be minutes, days, etc)
The maintenance counter type can be 2 words, 3, 4, etc..
I tried this regex, but it is returning me only events with maintenance counter type that contains 3 words :
index="emea_pj" "Maintenance counter" | rex field=_raw "(?ms)^(?:[^ \\n]* ){6}(?P<MaintenanceCounter>\"\\w+\\s+\\w+\\s+\\w+\")"
How can I achieve my goal?
thanks
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

adonio
Ultra Champion
04-02-2019
04:16 AM
try this anywhere:
| makeresults count=1
| eval data = "20/02/19 22:23:59 : Maintenance counter \"Digital Materials Mode\" Value is: 84 hours.;;;20/02/19 22:24:59 : Maintenance counter \"Another Counter\" Value is: 74 seconds.;;;20/02/19 22:25:59 : Maintenance counter \"Counter\" Value is: 64 minutes."
| makemv delim=";;;" data
| mvexpand data
| table data
| rename COMMENT as "above generates fake results, belew is your solution"
| rex field=data "(?<timestamp>\d{2}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2})\s\:\sMaintenance\scounter\s\"(?<counter>[^\"]+)\"\sValue\sis\:\s(?<value>\d+)\s(?<value_counter>[^\.]+)"
screenshot:
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

adonio
Ultra Champion
04-02-2019
04:16 AM
try this anywhere:
| makeresults count=1
| eval data = "20/02/19 22:23:59 : Maintenance counter \"Digital Materials Mode\" Value is: 84 hours.;;;20/02/19 22:24:59 : Maintenance counter \"Another Counter\" Value is: 74 seconds.;;;20/02/19 22:25:59 : Maintenance counter \"Counter\" Value is: 64 minutes."
| makemv delim=";;;" data
| mvexpand data
| table data
| rename COMMENT as "above generates fake results, belew is your solution"
| rex field=data "(?<timestamp>\d{2}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2})\s\:\sMaintenance\scounter\s\"(?<counter>[^\"]+)\"\sValue\sis\:\s(?<value>\d+)\s(?<value_counter>[^\.]+)"
screenshot:
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sarit_s
Communicator
04-02-2019
05:00 AM
when running the rex its returning result but if im running it with table it showing no results
index="emea_pj" "Maintenance counter" |SerialNumber
| rex field=data "(?\d{2}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2})\s:\sMaintenance\scounter\s\"(?[^\"]+)\"\sValue\sis:\s(?\d+)\s(?[^.]+)" |table data
