Re: Sitescope file monitor syntax for past dates (675 Views)
Reply
Advisor
nstout
Posts: 30
Registered: ‎02-04-2008
Message 1 of 11 (675 Views)
Accepted Solution

Sitescope file monitor syntax for past dates

We recieved a request to monitor a directory for four files that contain yesterdays date. We have monitors that use date variables for the current date, but this one will always be for the previous day.

The file names are like this:

IMPORT_4001_MM-DD-YY.txt

with the DD always being one day less than the current day (DD-1). How can I put this into an expression for sitescope? I have tried different syntax for [$day$-1] but nothing is working.
Honored Contributor
Amit Bandekar
Posts: 596
Registered: ‎06-24-2008
Message 2 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

Take a look at help section - "SiteScope Date Variables"

They mention minutes offset in one of the examples. There may be a $offsetDays as well (not sure). If not, you can just use the offsetMinutes by adding a negative value with the number of minutes in a day.

$offsetMinutes=mmmm$

--Amit
Advisor
nstout
Posts: 30
Registered: ‎02-04-2008
Message 3 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

I tried using the offset minutes but not sure if my expression syntax is correct since there is a path to the file involved. Here is what I have so far and it is not working for me:

s/\\servername\f$\pathname\$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/

The file exists in the directory as this:
PIP_IMPORT_4005_11-13-08.txt

Does anyone see an obvious error in the syntax?
Honored Contributor
Amit Bandekar
Posts: 596
Registered: ‎06-24-2008
Message 4 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

Try this:

s/\\servername\/f$\/pathname/$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/
Advisor
nstout
Posts: 30
Registered: ‎02-04-2008
Message 5 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

I tried the suggestion above but it is still returning a file not found error.

I am wondering if the $offsetMinutes$ variable is supported for this type of monitor? In the documentation it states that these variables can be used in content match fields. It doesnt say they can be used for file names. I know they work as-is for file names because we have several log file monitors set up that use them. All of the log files that we monitor are current date and time though.

This is a first for us to look for a file with a past date in the name.
Honored Contributor
Amit Bandekar
Posts: 596
Registered: ‎06-24-2008
Message 6 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

I tried the same on my test env here and it works fine. Not sure why you are getting the error. Does the sitescope user have access to the server where the log file is located?

s/\\servername\/f$\/pathname/$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/

--Amit
Advisor
nstout
Posts: 30
Registered: ‎02-04-2008
Message 7 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

Yes if I put the actual file name in there the monitor is fine. When I replace the file name with the variables it goes into error. Let me enter the full path here in case I made a typo. Just FYI we have to use IP name instead of DNS name because the server is behind a firewall. All other sitescope monitors work fine with the setup like that.

The path is \\10.10.9.64\f$\home\ABC\PIP_IMPORT_4005_MM-DD-YY.txt

Here is what I have in the monitor:

s/\\10.10.9.64\/f$\/home\/ABC\/$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/

I REALLY appreciate your help!
Honored Contributor
Amit Bandekar
Posts: 596
Registered: ‎06-24-2008
Message 8 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

I think I spot it..you seem to have an extra "\" after ABC

It should be this:

s/\\10.10.9.64\/f$\/home\/ABC/$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/
Advisor
nstout
Posts: 30
Registered: ‎02-04-2008
Message 9 of 11 (675 Views)

Re: Sitescope file monitor syntax for past dates

I think I may have figured out why it isnt working. I have a DEV Sitescope server running version 9.5 that I set up the monitor on and it works PERFECTLY. Our production server is version 8.5 and it is the one where the monitor will not work. I guess somewhere between version 8.5 and 9.5 there is a fix that allows this functionality. We are preparing our upgrade to version 9.5 now so at least I know it will work then. Thanks a million for your help!
Occasional Advisor
ERIKPGP
Posts: 10
Registered: ‎12-15-2011
Message 10 of 11 (457 Views)

Re: Sitescope file monitor syntax for past dates

This format s/\\10.10.9.64\/f$\/home\/ABC/$offsetMinutes=-1440$PIP_IMPORT_4005_$0month$-$0day$-$shortYear$.txt/ woks for me!

But how can i do to adjust for an actual date?... Thanks in advance.

Occasional Advisor
ERIKPGP
Posts: 10
Registered: ‎12-15-2011
Message 11 of 11 (450 Views)

Re: Sitescope file monitor syntax for past dates

The solution was:

s/\\hostname\/D$\/dir\/Logs/application$year$$0month$$0day$.log/

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.