Skip to main content
Question

How can I extract certain lines from a logfile (txt)

  • December 13, 2019
  • 4 replies
  • 62 views

Hi, I'm new at FME and want to do the following:

there's a process running at our server which is logged every night. We would like to get a warning when certain errorcodes pop up in the logfile.

For those (= [ERROR] and [WARN ]) of that night (filter on date of today) the whole line should be placed in another file.

The file looks like this:

2019-12-10 12:45:58,644 [WARN ] TrfAgiv.TrfCeviErrorHelper terreinobject 7654048 - CRCODE 'aardTerreinobject' - 'grbAdmPerceel' (6004) wordt niet verwerkt (NAARGEM = 0)

2019-12-10 12:45:58,646 [ERROR] TrfAgiv.TrfCeviErrorHelper terreinobject-huisnummer 20903264 - Niet alle noodzakelijke bovenliggende gegevens werden gevonden.

2019-12-10 12:45:58,647 [DEBUG] TrfAgiv.TrfCeviHelperEf terreinobject-huisnummer id: 20903322

2019-12-10 12:45:58,874 [DEBUG] TrfAgiv.TrfCeviHelperEf --> straatnaam id: 55794 opslaan, synchroniseren: False

 

There's an exemple of the file attached.

What would be the best way to go?

Thanks!

Isa

logfile.txt

4 replies

Forum|alt.badge.img

You can have a process that runs after the workspace from your log is finished, that reads this log as textfile and use a tester to look for lines with the Errors and Warns (Using "Contains") that you want to filter then save it.

 

Or a LogMessageStreamer in your workspace, then select the TAG that you want and save it. You can be more specific using a tester using "Contains" in the log message after the TAG selection.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 13, 2019

FME has the option to filter log messages.

Have a look at the options menu in FME Desktop:


warrendev
Enthusiast
Forum|alt.badge.img+23
  • Enthusiast
  • December 13, 2019

Using the python shutdown script is the way I go about parsing the log files.

 

 

Here is some good information going over how to set it up.

 

https://knowledge.safe.com/questions/60186/capturing-errors-in-fme-server-log-files.html

 


  • Author
  • December 16, 2019

Thanks for the quick reply everybody!

@rodrigo_ferrao I think I will go with your first option. I was trying with the stringsearcher before but I kept getting stuck building the regular exporession.

@erik_jan Thanks for the answer. But the process is not runing in FME (server). It's a totally different process and by scanning that log we hope to get a better view on things when it goes wrong. (kind of a black box right now)

@warrengis thanks for the answer: I'm almost there using the tester transformer but this info can get in handy another time!

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings