Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading from log file

Loading from log file

I have the below row in a log file.

This log is not set in table formation and I like to load it as table

2012-12-01 00:01:54,328 INFO  [ABC] Got request: action=getenv&cname=PEL&id=352622041677225&local=en &serving_ci=17528&serving_lac=6301&manufact=HELLO&model=9000T&os=2.2&version=1.1.12.1&wifi_ssid=&wify_ip=&mobile_apn_name=Internet+PEL&mobile_ip=10.100.00.101&height=800&width=480&ram=304&size=13544& intstorage_size=1917&home_mcc=42&home_mnc=03&service_mcc=42&service_mnc=03&coordinates=32.0278248%2C34.8897514&coordinates_accurate=false&coordinates_last_updated=0&pnames=facebook%7C1%2Cgallery%7C1%2Cplugin%7C1%2CAutocarIndia_Advice%7C1%2Cbbc_world%7C1%2Cyoutube%7C1

The first column should be the date and time (the green part)

The re part can be dropped

Then each column name is set after the ampersand sign (&) and its value after the equal sign (=)

Any ideas how this can be achieve?

Thanks,

Tomer

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Tomer

Would it be possible to load a small test file with about 100 lines?

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Gysbert_Wassenaar

Try:

Table:

load logtime, trim(subfield(parval,'=',1)) as parameter, trim(subfield(parval,'=',2)) as value;

load timestamp#(left(@1,23),'YYYY-MM-DD hh:mm:ss,fff') as logtime, subfield(mid(@1,24),'&') as parval;

LOAD @1

FROM

comm67571.log

(txt, codepage is 1252, no labels, delimiter is '\t', msq);

The result will be a table in the form

logtimeparametervalue
2012-12-01 00:01:54,328cnamePEL
2012-12-01 00:01:54,328coordinates32.0278248%2C34.8897514
2012-12-01 00:01:54,328coordinates_accuratefalse
2012-12-01 00:01:54,328coordinates_last_updated0
2012-12-01 00:01:54,328height800
2012-12-01 00:01:54,328home_mcc42

etc..

There will still be a record for "INFO  [ABC] Got request: action". If you want to get rid of this you can do a resident load with a where clause: where value <> 'getenv'


talk is cheap, supply exceeds demand
Not applicable
Author

sample can be found in the below link...

https://www.dropbox.com/s/vpqxvli8rdnix4a/Sample.txt

Thanks,

Tomer

Not applicable
Author

Thanks for that Gysbert ,

Can you please explain a little bit about the syntax and the logic that been using?

Tomer