Property file string of file is not defined

This line works:
(pathname of it) of item 1 of (maximum of modification times of files whose(name of it as lowercase ends with “.log”) of it, files whose(name of it as lowercase ends with “.log” of it) of it) whose (item 0 of it = modification time of item 1 of it) of folder “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__Global\Logs”

If I put a “lines of (file)” in front of it, I get an error
lines of (pathname of it) of item 1 of (maximum of modification times of files whose(name of it as lowercase ends with “.log”) of it, files whose(name of it as lowercase ends with “.log” of it) of it) whose (item 0 of it = modification time of item 1 of it) of folder “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__Global\Logs”

What am I missing? Some typecasting error?

Are you trying to read the most recent log of the BigFix Client?

If yes, that is not possible, the read rights are blocked. You will get the following error once you get your relevance fixed:

E: The expression could not be evaluated: File error "class FileIOError" on "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__Global\Logs\20170628.log": Windows Error 0x20: The process cannot access the file because it is being used by another
1 Like

I did see that error during other testing but figured I’d cross that bridge later. You’re telling me there is no bridge for that one, eh?

But even using minimum for the oldest file, I get an error. Even if I can’t accomplish the current task, I’d like to know what’s causing the error. Anyone…?

You were quite close. The ‘lines’ inspector is expecting a file object, whereas the above was only referencing a string (which happened to be a path). Try something like:

lines of file ((pathname of it) of item 1 of (minimum of modification times of files whose(name of it as lowercase ends with ".log") of it, files whose(name of it as lowercase ends with ".log" of it) of it) whose (item 0 of it = modification time of item 1 of it) of folder "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__Global\Logs")

Rather than hard-coding the path, consider something like the following:

lines of file ((pathname of it) of item 1 of (minimum of modification times of files whose(name of it as lowercase ends with ".log") of it, files whose(name of it as lowercase ends with ".log" of it) of it) whose (item 0 of it = modification time of item 1 of it) of folder (data folder of client as string & "\__Global\Logs"))

Also, with regard to being able to read the current day’s log, there may be some updates in this space coming soon.

2 Likes

hey !! i want to read lines of file in current file log ,what should i do ?
thank you

Look at the “lines of file” inspector. You will need to figure out what lines have the info your are interested in.

Q: lines of file "20180311.log" of folder (data folder of client as string & "\__Global\Logs")

"Error: The expression could not be evaluated: File error “class FileIOError” on “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__Global\Logs\20180320.log”: Windows Error 0x20: The process cannot access the file because it is being used by another " this word after evaluate from my code , I want to read line of file at current day
my code: ****nes of file whose(modification time of it = (maximum of modification times of files of folder “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__Global\Logs”)) **
of folder "C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__Global\Logs"
what should i do???
thank you bro :grin:

The error is because you are trying to read the file that the Bigfix client has open for write access. I believe the file inspectors had been updated in 9.5 to allow for parsing open files but maybe it can’t with its own logs (file in use by the process that is trying to read it?)

A separate property was introduced. Try ‘locked lines of file’

5 Likes

Ahh, that was what I was missing, thanks @JasonWalker :+1: So add that to Aram’s original relevance changing from minimum to maximum and it works.

Q: locked lines of file ((pathname of it) of item 1 of (maximum of modification times of files whose(name of it as lowercase ends with ".log") of it, files whose(name of it as lowercase ends with ".log" of it) of it) whose (item 0 of it = modification time of item 1 of it) of folder (data folder of client as string & "\__Global\Logs"))
A: 
A: Current Date: March 20, 2018
A:    Client version 9.5.8.38 built for WINVER 6.0 i386 running on WINVER 10.0.15063 x86_64
A:    Current Balance Settings: Use CPU: True Entitlement: 0 WorkIdle: 10 SleepIdle: 480
A:    ICU 54.1 init status: SUCCESS
A:    Agent internal character set: UTF-8
A:    ICU report character set: UTF-8 - Transcoding Disabled
A:    ICU fxf character set: windows-1252 (Latin 1 / Western European) - Transcoding Enabled
1 Like

thank you @SLB @JasonWalker but after evaluate this code about locked lines of file ,it will error = the property 'locked lines of file is not defined. what should i do that ?

You’ll have to upgrade to a higher version of the client. The “locked line” inspector was added in 9.5.7.

https://developer.bigfix.com/relevance/reference/file-line.html

1 Like

thank you very much broo