Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can access read from .LOG files? 1

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
0
0
GB
Hello,


I have a proxy server that pumps all of its logs out in a .log format. From what I have tried Access cannot read this format. Its in a tabed format but I cannot get it to work.

As its a real time proxy its not praticle to just copy it into Excel as I want to look at it three or four times a day.

Anyone help?

Steve Hewitt
 
You could create your own import specification for use in standard Access data imports, or write your own file parser. I have done both in the past.
 
Hi,

I can't say I have done this, or even really heard about it before! It would have to be a linked table to ensure its uptodate. Have you got an example or step by step info by any chance?!

Thanks,

Steve Hewitt
 
File -> Get External Data -> Import...
Change the Files of Type to be Text Files (*.txt;*.csv;*.tab;*.asc) (may require installing additional ISAM drivers)
Then type *.* into the File Name box and hit enter - it will now list all files. Locate your file, then play with the settings to see if you can import it. It should work if the file is tab-delimited.
 
Oh yeah! Access seems to have trouble with files that do not explicitly end with ".TXT" - try making a copy of the log, rename it as .TXT, and see if the import/link process works.
 
Found a round about way for you to do it.
Use Task Scheduler to schedule the bat file to run whenever you need it to.

Open notepad and write:

C:
cd\{path}
xcopy info.log "{path}\info.txt" /s

Where the 1st line indicates the letter of the drive where the log is stored.
2nd line indicates the path where it is stored.
and the 3rd line indicates the command (xcopy), the file to copy (*.log), and where to save it to (and the format).

Save this as convert.bat (or <whatever you want to call it>.bat )

Then in Access File --> Get External Data --> Link Tables

Find your txt file and link to it.

Task scheduler should then run the bat file, which will convert the *.log to *.txt, and access can read the *.txt file.

If you dont understand what im talking about just state what you don't understand.

Regards

Samulayo
 
Hey everyone,

thanks for your help. The .bat file is a good idea, and one that I am going to test shortly.


Thanks again,

Steve Hewitt
 
If you create an import specification and save it, you can then run it from code and specify the filename irrespective of the file extension, whether .txt, .csv, .sandwich or whatever.

How come Samulayo gets a star for writing a batch file to copy a file?! Pah!
 
Hey, this is my first star, don't take that from me!
Also it requires the least amount of time/effort to do and maintain.

Regards

Samulayo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top