Extract data between two timestamp

Hi All,

I have a log file which has several timestamp.
I want to extract the data between two timestamp, i am getting starting timestamp value from a variable which i have extracted from a website.

Can anyone help me on this and guide me how to resolve this?

Can you explain with the some examples, what you want exactly? @pradyumn.agrawal

1 Like

Hi,
Below is the log file which is starting with TimeStamp,
I know the value of First timestamp and i want to extract the data after first timestamp till starting of second timestamp.

[2020-06-08T07:53:37.506+0200] [Payara 4.1] [INFO] [] [tid: _ThreadID=595 _ThreadName=orb-wmq.jmsra-thread-pool (pool #2): worker-9] [timeMillis: 1591595617506] [levelValue: 800] [[
** [IRAM] —> iRAM - FAV <— STOP newTURevision]]**

[2020-06-08T07:53:37.508+0200] [Payara 4.1] [INFO] [] [tid: _ThreadID=595 _ThreadName=orb-wmq.jmsra-thread-pool (pool #2): worker-9] [timeMillis: 1591595617508] [levelValue: 800] [[
** [IRAM] FAV web service ‘newTURevision’ for change context ‘11349’ was successful and returned the new FAVScopeRevisionId: ‘895469096’]]**

@pradyumn.agrawal - you can try with substring option

the data is not fixed it can be upto 20 lines and can be of 2 line as well
How can i use substring?

@pradyumn.agrawal - if you know start and end values -> it will be easy to get the between text with substring option.

str.Substring(str.IndexOf(startDate)+startDate.Length,str.IndexOf(endDate)-str.IndexOf(startDate)-startDate.Length)

The point is i don’t know the end date
I am extracting the data from a website and filtering the starting timestamp and storing in a variable from it.
Now i want to extract the data after my filtered timestamp and before next timestamp.

Will there be always two timeStamps or will there be more and you want to extract data between each of them?

Hi,
There will be more timestamp but i want to extract data from particular timestamp which i have stored in a variable note1.

So these two values will be stored in your variables ?

Only this one

@pradyumn.agrawal I have managed to get the data in by using two regex expresssions. But the end data after the Second TimeStamp will not be extracted. Do you want it to be extracted or not since the condition was extracting data between two TimeStamps

HI,
No i don’t want the data after second timestamp.
My requirement was to extract data after first timestamp only

@pradyumn.agrawal Not sure if i have got it right, but check this Workflow and check the input data that was assigned. Execute the Workflow. Check if the Output is the data that you need. I have altered the Input data by adding two more similar data.

RegexFind.xaml (9.0 KB)

It is working fine but the regular expression which you have used will be eligible for only one kind of data.
What if the data between two timestamps increased by 20 lines.
And log file contains more than 10,000 lines i want to get data after my filtered timestamp till next timestamp.

@pradyumn.agrawal Can you try and check for that particular data, as I did not have that kind of data. I couldn’t test it but i think it should work.

it is failing when i am passing whole log value in strInput
I have given
strInput=Log.Substring(Log.IndexOf(note1))

Where Log has all the data from log file and note1 contains timestamp from where i want to extract the data.
I am also getting below error

understand my requirement like
I am fetching some data from web and extracting the timestamp1 from that
now i have to check my log file that if the timestamp is available or not,
i searched timestamp1 in my log file which contains more than 10000 lines and have mutiple timestamps.

I want to extract the data from my timestamp1 to till next timestamp.

Can you Write this value to a text file and send the text file? We’ll need to understand the difference in it.

100 lines of it might be enough if possible :sweat_smile:

You want the log file value ?

@pradyumn.agrawal Yes. If possible and if it’s not confidential :sweat_smile: