AaroN⍩ Posted August 21, 2020 Posted August 21, 2020 Hi, I hope someone can help me with this question, I would like to display the latest server logs on a website using PHPSDK but I have a question on how to do it efficiently as it will update in real time. any ideas?
MTA Team 0xCiBeR Posted August 21, 2020 MTA Team Posted August 21, 2020 Do you have a custom server log system? What type of logs do you wish to sync? Have you tried using a service like webmin/docker and some kind of log shipper?
Yaaruu Posted August 22, 2020 Posted August 22, 2020 On 22/08/2020 at 01:27, AaroN⍩ said: Hi, I hope someone can help me with this question, I would like to display the latest server logs on a website using PHPSDK but I have a question on how to do it efficiently as it will update in real time. any ideas? I'm not sure if it's possible to achieve real time with just PHP. Maybe you can use socket that can be listened with javascript client.
Discord Moderators Zango Posted August 28, 2020 Discord Moderators Posted August 28, 2020 You can open a file handle on server.log and read it periodically. Move the pointer to end of file after opening it initially, and read from it at some interval (500ms should feel like realtime).
Master_MTA Posted August 30, 2020 Posted August 30, 2020 other sol you can use ajax but it's not that good idea
AaroN⍩ Posted December 29, 2020 Author Posted December 29, 2020 On 28/08/2020 at 09:37, Zango said: You can open a file handle on server.log and read it periodically. Move the pointer to end of file after opening it initially, and read from it at some interval (500ms should feel like realtime). Initially I did it like this, but it is not efficient since you have to count the lines of the server.log and then take the last 20 lines, for example, and do it every 5 seconds is 0 efficient.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now