Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

[Dispatcher] .stat file not generated

Avatar

Level 3

Hi,

I'm configuring dispatcher to generate the .stat file from the config:

/cache

{

  # the cacheroot must be equal to the document root of the webserver

  /docroot "/mnt/cache"

  # sets the level upto which files named ".stat" will be created in the

  # document root of the webserver. when an activation request for some

  # handle is received, only files within the same subtree are affected

  # by the invalidation.

  /statfileslevel "1"

}

By right, the stat file should be auto-generated at docroot (/mnt/cache) when I restart apache, but there was no file generated (I check with command ls -la).

From the log when I access the dispatcher:

[Thu Sep 27 10:43:05 2018] [D] [pid 19238] Found farm publishfarm for dispatcher

[Thu Sep 27 10:43:05 2018] [D] [pid 19238] checking [/content/mywebsite/en.html]

[Thu Sep 27 10:43:05 2018] [D] [pid 19238] never flushed [/mnt/cache/content/mywebsite/.stat] -> use cache [/mnt/cache/content/mywebsite/en.html]

[Thu Sep 27 10:43:05 2018] [D] [pid 19238] cache-action for [/content/mywebsite/en.html]: DELIVER

[Thu Sep 27 10:43:05 2018] [D] [pid 19238] request declined

[Thu Sep 27 10:43:05 2018] [I] [pid 19238] "GET /content/mywebsite/en.html" - - 0ms

Please advise me on this. Any help would be appreciated.

My dispatcher version is 4.2.2 for Apache 2.4 on Linux 64 bit.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hello Manh,

The behavior you're seeing is expected. It's because you've added the statefileslevel with a value of "1".

The value of "1" means that there will be two .stat files, one at the docroot itself, and another one at docroot and one at the /content directory. So you should see a .stat file in the /mnt/cache and at /mnt/cache/content directories.

If you wish to see a .stat file generated for every single one of your content levels, you'll have to change the statfileslevel to "6", or "7" or to the depth of your site structure and then replicate a page. For example, if you wish to see the .stat file at /content/mywebsite/test1/test2/test3/test4, you'll have to set the statfileslevel to "7", restart the dispatcher and replicate the page to see the .stat file.

For further information about this stat file's usage and it's implications, please check Configuring Dispatcher

Best Regards,

Aneet Arora

View solution in original post

11 Replies

Avatar

Community Advisor

Dear Manh,

Looking at your log. The request is actually being served from Cache.

Kindly look at /mnt/cache/content/mywebsite and check for .stat file there.

Regards,

Peter

Avatar

Level 10

as your statfilelevel is set to 1, it should be under /content/mywebsite

Avatar

Level 3

Hi guys,

Thanks for replying.

I checked at the path /mnt/cache/content/mywebsite with command "ls -la", but I see no stat file created (I'm logged as root).

Avatar

Employee

You need to configure a flush agent (Invalidating Cached Pages From AEM ) and replicate at least once. Then check /mnt/cache/content/mywebsite for a .stat file

Avatar

Correct answer by
Level 5

Hello Manh,

The behavior you're seeing is expected. It's because you've added the statefileslevel with a value of "1".

The value of "1" means that there will be two .stat files, one at the docroot itself, and another one at docroot and one at the /content directory. So you should see a .stat file in the /mnt/cache and at /mnt/cache/content directories.

If you wish to see a .stat file generated for every single one of your content levels, you'll have to change the statfileslevel to "6", or "7" or to the depth of your site structure and then replicate a page. For example, if you wish to see the .stat file at /content/mywebsite/test1/test2/test3/test4, you'll have to set the statfileslevel to "7", restart the dispatcher and replicate the page to see the .stat file.

For further information about this stat file's usage and it's implications, please check Configuring Dispatcher

Best Regards,

Aneet Arora

Avatar

Level 8

I think there is a miss communication out here, the stat file is not appearing for him, according to the theory, it should appear and he is asking why it is not appearing. correct me if I am wrong

Avatar

Level 5

rajas66269496

That's my understanding as well. And my response addresses that with some more details.

To answer your question, it is not the right expectation that .stat file will be generated in all the directories in the cache. So I answered the question stating "why is it not appearing" because the "statfileslevel" is set to "1", which means .stat files will only be generated at docroot and one level below docroot, that's it.

Please test this out on your end as well for confirmation.

Avatar

Level 3

Hi guys,

Thanks for sharing your thought.

I found the issue, that the dispatcher flush agent is set the HTTP headers to "CQ-Action-Scope: ResourceOnly". I removed it then do a replicate, the .stat files are generated.

From my understand, it's used for the dispatcher flush rules inside ResourceOnly. Can I know if I remove this from dispatcher flush agent is ok? I still have some dispatcher flush rules inside ResourceOnly (in OSGi config).

Regards,

Manh

Avatar

Level 8

Generally we use this "CQ-Action-Scope: ResourceOnly" if you want to invalidate particular resources without touching stat file on daily basis, example: external feeds, JSON responses etc... please check if you have any requirement on this before deleting

Avatar

Level 2

I'm having the same issue. The ".stat" file was never created. When the page is activated I don't see any logs in dispatcher_log file. Was hoping to see log something like this when the page is activated.

[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] Found farm sites for localhost
[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] checking [/dispatcher/invalidate.cache]
[Sat Jan 09 21:07:19 2021] [I] [pid 8:tid 139698416600832] Activation detected: action=Activate [/content/we-retail/us/en]
[Sat Jan 09 21:07:19 2021] [I] [pid 8:tid 139698416600832] Touched /etc/httpd/httpd_www/aem_sites/.stat
[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] response.status = 200
[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] response.headers[Content-Type] = "text/html"
[Sat Jan 09 21:07:19 2021] [D] [pid 8:tid 139698416600832] cache flushed
[Sat Jan 09 21:07:19 2021] [I] [pid 8:tid 139698416600832] "GET /dispatcher/invalidate.cache" 200 purge [sites/-] 7ms

 

In Flush Agent, when I test the connection I see the connection properly established however, I see the success message something like this.
022-06-03 00:00:42 - << color: #EB957D;
2022-06-03 00:00:42 - << text-shadow: 0 0 3px black;
2022-06-03 00:00:42 - << }
2022-06-03 00:00:42 - << </style>
2022-06-03 00:00:42 - << </head>
2022-06-03 00:00:42 - << <body>
2022-06-03 00:00:42 - << <div class="error-page-wrap">
2022-06-03 00:00:42 - << <article class="error-page gradient">
2022-06-03 00:00:42 - << <hgroup>
2022-06-03 00:00:42 - << <h1>403</h1>
2022-06-03 00:00:42 - << <h2>Are you lost?</h2>
2022-06-03 00:00:42 - << <br/>
2022-06-03 00:00:42 - << </hgroup>
2022-06-03 00:00:42 - << </article>
2022-06-03 00:00:42 - << </div>
2022-06-03 00:00:42 - << </body>
2022-06-03 00:00:42 - << </html>
2022-06-03 00:00:42 - Message sent.
2022-06-03 00:00:42 - ------------------------------------------------
2022-06-03 00:00:42 - Replication (TEST) of /content successful.

 

not sure where is wrong? I made sure there is not permission issue from dispatcher side. 


Thank you!