Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Yellow_No5
New Contributor

How to get a timestamp in FortiGate Webfilter Block pages

Hello Everyone,

 

I am looking to add a timestamp to messages such as the attached.  I spoke to FortiSupport and they said there isn't a variable I can call for the information and suggested using JavaScript.

 

The message I am trying to add the timestamp to is at System > Replacment Messages > Extended View > URL Filter Error Messages.

 

The code I have used is -

<p id="timeStamp">
</p>
<script>
  var tzoffset = (new Date()).getTimezoneOffset() * 60000;
  //offset in milliseconds
  var localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -5);
  
  var repl01=localISOTime.replace("T", " ");
  
  document.getElementById("timeStamp").innerHTML = repl01;
</script>

The code works locally and when pasted into the 'Try It Yourself' links on w3schools.com.  However, nothing is displayed in the Fortiguard Web Page Blocked message.

 

What do I need to do to get the JavaScript to display in the Web Page Blocked message?

 

Also, I am really trying to get the timestamp to display in the ISO format because it is literally a copy and past into the 'Device Time' filter when browsing logs.

 

Thanks for any information.

0 REPLIES 0
Labels
Top Kudoed Authors