Logs in the OutSystems Platform
Certified

Logs in the OutSystems Platform
Certified

  
Hi guys,

This post serves to explain a bit how logs are kept in the OutSystems Platform, for how long they are kept and how you can access them.

For each type of log there are 10 tables in the form: OSLOG_<TYPE>_<CYCLE> . For example, oslog_error_7 is the 7th table in the error log cycle.

For each type of log there is a view which points to the current table in the cycle, named OSLOG_<TYPE>. For example, oslog_error always points to the latest week's logs. [NEW in 8.0] There is also a view oslog_<type>_previous for logs in the previous week. This means that in Service Center you are now able to access logs from this week and the last, not just the current week.

The OutSystems Platform is capable of keeping logs for longer than they are displayed in Service Center. By default the OutSystems Platform keeps logs for 4 weeks, and can keep them for as long as 9 weeks. This is configurable in Configuration Tool, Logs tab [Windows] or Advanced Configuration Settings section [Linux].

Logs are always inserted directly into the table corresponding to the date of the log. The view is rotated by an internal task of the OutSystems Log Service which runs at midnight on Friday.

Logs are rotated cyclicly, meaning that after table 9 is used, table 0 will be used on the next week. Conversely, if this week's table is table 1, the table used 3 weeks ago is table 8. Basic modular arithmetics.

All these tables have a CYCLE column which allows you to quickly understand which table is being used in the current week. You need only do SELECT TOP 1 CYCLE FROM oslog_error (SQL Server Syntax) or SELECT CYCLE FROM oslog_error WHERE rownum = 1 (Oracle Syntax) to immediately know which is the current cycle and do math from there.

Every week the Log Service will truncate the table in (current cycle - log cycle length) mod 10 to clear space from the database and allow new logs to be inserted when the time for that table to be used again comes.

If you have further questions about how log tables are managed by the OutSystems Platform, don't hesitate to place them here and I'll answer them.

Best regards,
Ricardo Silva
Thank you for the explanation Ricardo. It's always good to know a little bit more about the inner workings of the Platform.
Hi,
I am using javastack of outsystems.
Is it possible to change the logs store from 4 weeks to 9 weeks at runtime instead of configuration tool?
Is there a seperate batch file to change this configuration instead running whole configuration tool?

Thanks,
Thiru
No, you have to set these in Configuration Tool.

Why do you not want to use Configuration Tool for this?
Hi,

I could able to retrive data from last two months only. But I wanted the user log from the date of starting of the application.

I ran below select queries: 

select * from [dbo].[oslog_Screen_0] l
left join [dbo].[ossys_User] u on u.id = user_id
where ESPACE_ID = 15
union 
select * from [dbo].[oslog_Screen_1] l1
left join [dbo].[ossys_User] u on u.id = user_id
where ESPACE_ID = 15

...
...
union 
select * from [dbo].[oslog_Screen_9] l9
left join [dbo].[ossys_User] u on u.id = user_id
where ESPACE_ID = 15

Am I looking into wrong tables? Where am I missing? 
As stated the OutSystems Platform keeps logs for a maximum of 9 weeks. More than that is not possible to retrieve using the OutSystems Platform tables.

If you have a requirement to keep logs for longer, you should build your application to copy the logs from the OutSystems Platform into your own tables, and manage the data on those tables according to your retention policies.
Where Can I find configuration tool? I need to change my logs durations from 4 weeks to 9 weeks.

I am currently looking at below location:
ServiceCenter - Administration > Environment Configuration

But I can't see where to change log duration time. 
Configuration Tool is a program that will exist in your Platform Server installation.

In Windows you can access it by logging into the machine with an Administrator account and running the Configuration Tool program.

In Linux you can access it by logging into the machine as root and running /opt/outsystems/platform/configurationtool.sh .

I hope with this you are able to perform the configuration you require.

Best regards,
Ricardo Silva

Hi Ricardo,

It seems to me that logs in outsystems have a maximum length of 2000 characters. Am I correct? If so, is there any way to change this maximum length?

Thank you.

Hello Ana,

What logs are you referring to? Different kind of logs have different restrictions in different fields.

Are you talking specifically about the size you can add to the message in Audit action (which ends up in General Log) ? Yes, that is restricted to 2000 characters and cannot be changed.

If you need to log larger amounts of data, I recommend you create your own database table for it and use the Asynchronous Logging extension to insert data into it.

Best regards,

Ricardo Silva

Can you provide me some example on how to use this extension, so I can quickly test its functionality?

I'm getting the error "Unable to convert to record". I think I'm not doing this right and I didn't find any examples on the web..

Thank you.

Actually, let me provide some more information on this:

We need to log information for requests and responses either through outsystems modules or through .NET extensions.

Currently, we're using GenericExtendedActions.Audit to do this, but Service Center cannot give us all the information about this logs (I assume that is because of the size limit you referred).

What I actually need to know is how can we implement asynchronous logging in this situtation. Can you help me?

Thank you,

Ana Santos

Hello Ana, since this question is outside the scope of this thread, I took the liberty of opening a new thread with  your question and replying to it. Please continue this discussion there.