Hi @gcusello
The following solution is working for me:
| rex "(?<TimeStamp>\d+-\d+-\d+ \d+:\d+:\d+\.\d+ \+02:00)\s+[^ ]"
| fields - _time
| eval _time=strptime(TimeStamp,"%Y-%m-%d %H:%M:%S.%3N %:z")
| sort -_time
| eval ret_event = split(_raw, ":")
| eval owcs_msg = mvindex(ret_event,4)
| eval owcs_msg_splited = split(owcs_msg, ";")
| eval owcs_msg_id = mvindex(owcs_msg_splited,0)
| eval owcs_msg_station = mvindex(owcs_msg_splited,1)
| eval owcs_msg_status = mvindex(owcs_msg_splited,2)
| where owcs_msg_status = 57 OR owcs_msg_status = 59
| transaction owcs_msg_station endswith=owcs_msg_status=59 keepevicted=true
| eval counter=1
| accum counter as Row
| mvexpand TimeStamp
| stats min(_time) AS NotAvailableTimeStamp max(_time) AS AvailableTimeStamp BY owcs_msg_station Row field1
| eval NotAvailableTimeStamp=strftime(NotAvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N"), AvailableTimeStamp=strftime(AvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N")
| eval ts1=substr(field1,0,30)
| eval _time1=strptime(ts1,"%Y-%m-%d %H:%M:%S.%3N %:z")
| eval owcs_msg_splited1 = split(field1, ";")
| eval owcs_msg_station1 = mvindex(owcs_msg_splited1,1)
| eval owcs_msg_status1 = mvindex(owcs_msg_splited1,2)
| stats min(_time1) AS NotAvailableTimeStamp max(_time1) AS AvailableTimeStamp by owcs_msg_station1 Row
| eval NotAvailableTimeStamp=strftime(NotAvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N"), AvailableTimeStamp=strftime(AvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N")
Hi @gcusello
when I use the following script then I get the result below:
.......
| mvexpand TimeStamp
| stats min(_time) AS NotAvailableTimeStamp max(_time) AS AvailableTimeStamp BY owcs_msg_station Row field1
| eval NotAvailableTimeStamp=strftime(NotAvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N"), AvailableTimeStamp=strftime(AvailableTimeStamp,"%Y-%m-%d %H:%M:%S.%3N")The result: There is "field1" column with correct information.
Hi @OnderSentira,
what's the problem?
im my test I have for each Station more transactions with start and end time.
please give me a sample of the result tha you have and the ones you want, e.g. for one Station.
Ciao.
Giuseppe
Hi Giuseppe
The both column have same timestamp.
Hi Giuseppe,
See part of the events below. And I have used the following Script to extract the fields from the events:
my Search "MyApp<<<--MQ: 025;"
| eval ret_event = split(_raw, ":")
| eval owcs_msg = mvindex(ret_event,4)
| eval owcs_msg_splited = split(owcs_msg, ";")
| eval owcs_msg_id = mvindex(owcs_msg_splited,0)
| eval owcs_msg_station = mvindex(owcs_msg_splited,1)
| eval owcs_msg_status = mvindex(owcs_msg_splited,2)
| eval start = if(owcs_msg_status = 57,_time,"")
| eval stop = if(owcs_msg_status = 59,_time,"")
| eval start= strftime(start,"%Y-%m-%d %H:%M:%S.%3N")
| eval stop= strftime(stop,"%Y-%m-%d %H:%M:%S.%3N")
Hi @OnderSentira,
sorry, but what's the correlation rule?
in other words: why do you exclude some values and takes some other?
Ciao.
Giuseppe