You have to login in order to post a reply to this topic.

9 replies [Last post]
topakitz
topakitz's picture
User offline. Last seen 1 year 21 weeks ago. Offline
Joined: 08/21/2010
Posts: 8

 

Hi... i'm new in WinAutomation so just starting to explore it.

Could anyone help me create a job in WinAutomation that will search a specific text in a log file. The log file contains date, time and an error. It should be display those in items in a result log.

Is it possible to use the Read Text from File action with the stored file content as List?

Thanks in advance. ^_^

Samantha
Samantha's picture
User offline. Last seen 1 hour 4 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: How to find specific text in a log file

Hello topakitz,

Could you please provide a sample text of the line you will be looking for in the Job?

The Job should have the following Actions:

1. Read Text from file
2. Create New List
3. Parse text (you will probably have to enter a regular expression to look for the line you are looking for.
4. Add item (%Match%) to List

Let me know if this worked for you..

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

topakitz
topakitz's picture
User offline. Last seen 1 year 21 weeks ago. Offline
Joined: 08/21/2010
Posts: 8
Re: How to find specific text in a log file

The file that I want to search is the "*** error". I also want to include the date and time in front of the error message.

When using the following Actions you recommended an error occur in parsing the text. Cannot convert list of general values into a Text value.

I have attached the sample text. Thank you

AttachmentSize
sample.txt 3.46 KB
Samantha
Samantha's picture
User offline. Last seen 1 hour 4 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: How to find specific text in a log file

Hello topakitz,

Please check the job attached.. hope it's what you were looking for.
Let me know if it worked for you

:)
Samantha

AttachmentSize
topakitz.waj 15 KB
__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

topakitz
topakitz's picture
User offline. Last seen 1 year 21 weeks ago. Offline
Joined: 08/21/2010
Posts: 8
Re: How to find specific text in a log file

Hi Samantha,

Thank you for your reply, the job attached really helps though i'm having some problems regarding the current modified selection of the file.

For example I have a 3 files.

File 1 = Aug 23 2010 - sample.log

File 2 = Aug 22 2010 - sample.log

File 3 = Aug 14 2010 - sample.log

And I only want to search the latest log file in the 3 example files.

Thanks. ^_^

Samantha
Samantha's picture
User offline. Last seen 1 hour 4 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: How to find specific text in a log file

Hello topakitz,

in that case, you use the "Get the files in the folder" action, and get the file that was last created. Then run the actions i sent you in the previous job.

If you have difficulties building it, let me know.

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

topakitz
topakitz's picture
User offline. Last seen 1 year 21 weeks ago. Offline
Joined: 08/21/2010
Posts: 8
Re: How to find specific text in a log file

Hi Samantha,

I already solved the problem regarding getting the latest file. Thanks for answering all my questions. It really helps alot.

^_^

Topakitz

Peter_rasmussen
Peter_rasmussen's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 03/18/2011
Posts: 5
Re: How to find specific text in a log file

Hello

 

Can anybody help me to slove my problem ?

. In  Add item to List action , I wanna  like to Add only Jpeg files.

In Get file action i didn't use any filter *.jpeg.

firstly i want to get all the files then filter only jpeg files and Add into List .

 

Dont know how it will works?

 

Peter

Samantha
Samantha's picture
User offline. Last seen 1 hour 4 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: How to find specific text in a log file

Hello Peter,

You could try either using a second Get Files in Folder action and filter it to get a list that contains jpg files only, or loop through the existing list, and using an If condition action, check of the %CurrentFile.Extension% is equal to jpg. If so, you would then add the %CurrentFile% to the %JPGFiles% List (this list you would have to create it outside the loop using the Create New List action).

Hope this is what you are after

Please keep us updated with your progress

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

Peter_rasmussen
Peter_rasmussen's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 03/18/2011
Posts: 5
Re: How to find specific text in a log file

 

Hi Samantha,

 

Now i displayed all the jpg files through the new list.

 

 

Thanks .

Peter.