2

I'm stuck on a dead end with this logparser dilemma. so there's no where else to go but here.

Batch file (disktrend.bat)

@echo off    
pushd "Program Files (x86)\Log Parser 2.2\"
for /f "tokens=1,2 delims=," %%A in (d:logs\serverdrives.txt) do @logparser -i:tsv file:D:\logs\disktrend.sql?sd=%%A -o:chart -charttype:line > D:\logs\%%B.gif  

SQL file (disktrend.sql)

SELECT date,pfree using to_int(sub(to_real(100),to_real(replace_chr(free,'%','')))) as pfree,replace_chr(strcat(server,drive),':','') AS serverdrive from d:\logs\compiled\*.log where serverdrive =%sd%  

List file (serverdrives.txt)

'SERV06F',SERV06F  
'SERV00F',SERV00F

Log file sample content (*.log)

Date    Server  Drive   Free    Free Space  Total
20120914    SERV06      F:  79.55%  27619.02MB  34719.82MB
20120914    SERV00      F:  99.73%  34630.37MB  34723.81MB  

When I run the batch script, I get below error:

Error

Invalid output filename ""   
Invalid output filename ""  

Does anyone know how to solve this?

2
  • 1
    +1; Refreshingly well constructed question from a new user. Wish I could help, but I'm drawing a blank. Commented Oct 8, 2012 at 13:11
  • Thanks for the compliment @dbenham. i got it already :) Commented Oct 8, 2012 at 14:27

1 Answer 1

1

while eating dinner an answer suddenly popped on me.
I edited the Batch and SQL files.
See below.

Batch file (disktrend.bat)

@echo off    
pushd "Program Files (x86)\Log Parser 2.2\"
for /f "tokens=1,2 delims=," %%A in (d:logs\serverdrives.txt) do @logparser -i:tsv file:D:\logs\disktrend.sql?sd=%%A+filen=%%B -o:chart -charttype:smoothline -q:off -stats:off

SQL file (disktrend.sql)

SELECT to_string(date),pfree using to_int(sub(to_real(100),to_real(replace_chr(free,'%','')))) as pfree,replace_chr(strcat(server,drive),':','') AS serverdrive into d:\logs\%filen%.gif from d:\logs\compiled\*.log where serverdrive =%sd% 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.