Link to home
Start Free TrialLog in
Avatar of enthuguy
enthuguyFlag for Australia

asked on

Convert windows log file to Json format

Hi Experts,

could you suggest the best way to convert custom application text log file to json format please

Read the whole file and convert line by line to json on a windows server.

Since application generate log in its custom location, may be I should read this directory for each file > convert each line to json object, place it in a different location. Also we should not duplicate or read the same line again :)

Also is it possible to apply similiar logic to windows events log.

please advice
Avatar of ste5an
ste5an
Flag of Germany image

As you asked for the best way: You start this task by defining/implementing your JavaScript object. Thus begin with your data consumer before trying to define on a data exchange format.
1) Best way to convert custom application text log file to json format...

If you have access to the source code, best way will be to produce the JSON version yourself, as parsing text -> JSON is much harder than just producing the JSON in the beginning.

2) Also is it possible to apply similiar logic to windows events log.

Yes. Anything's possible. Only requirement is writing the code.

You just write some code to read/parse a text record, create whatever JSON equivalent seems best to you, output the JSON to another file.
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enthuguy

ASKER

Thanks Stefan, David, and Footech,

Footech, could you advice me logic to write PS to write all events to json and then only the delta (only logged after first extract) please
Thanks!!!