Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:22:08+00:00 2026-06-15T10:22:08+00:00

We are going to a deployment setup where we will have many servers, most

  • 0

We are going to a deployment setup where we will have many servers, most of which auto-added to the load balancer when the traffic goes up. The trouble with this setup is that if an individual developer needs to tail logs to troubleshoot something, he will have to open a console on each server, which is made complicated by the fact that the developer often doesn’t know HOW many servers we might have in function at that time.

If the developer can find all the logs in one server – say our deploy server, then the troubleshooting becomes easier.

Towards this, I was thinking of setting up a push from each FE machine to the deploy server using a cron which will replicate the logs on our deploy server. There are two problems with this approach:

  • There is a lag of 1 minute because crons can’t be run more frequently.
  • The cron on each FE machine will have to set up to sync to a specific location on the deploy server, but up front, I don’t know how many such FE servers will exist.

To solve this problem, I am looking at a way to connect error_log, or PEAR Log to send the logs directly to our deploy server, which will log it in real time to it’s local locations at /var/log/..

Anybody knows how I can configure this? Or perhaps a service which accomplishes this?

Our servers are all Ubuntu 10.04 LTS and we are running these servers on EC2 instances in AWS. Our PHP version is 5.3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:22:09+00:00Added an answer on June 15, 2026 at 10:22 am

    The answer from @MichelFeldheim was the genesis, but we improved upon it to handle multiple applications writing to multiple log files.


    Central Logging Server

    In the central logging server, install syslog-ng and configure it thus:

    sudo apt-get install syslog-ng
    

    add the following to /etc/syslog-ng/syslog-ng.conf:

    destination d_php { file("$PROGRAM" owner(www-data) group(www-data) perm(0644)); };
    filter f_php { program("^\/var\/log\/"); };
    log { source(s_all); filter(f_php); destination(d_php); flags(final); };
    
    source s_all {
            # ....
            # .... LET THE PREVIOUS CONTENT STAY - add the following line
            tcp(port(5140) keep_alive(yes));
    };
    

    restart syslog service:

    sudo service syslog-ng restart
    

    On FE Servers

    On each of the FE Servers, install syslog-ng and configure it thus:

    sudo apt-get install syslog-ng
    

    add the following to /etc/syslog-ng/syslog-ng.conf on each of the FE servers:

    destination php { tcp("log.example.com" port(5140)); };
    log { source(s_all); filter(f_php); destination(php); };
    filter f_php { facility(user); };
    

    restart syslog servers:

    sudo service syslog-ng restart
    

    Application Code Changes:

    Now, the application code can be changed thus. Suppose each of the application have code like this writing to a separate file and you want the same structure to be reflected in the central log server:

    // PREVIOUS CODE: using PEAR Log
    include '/usr/share/php/Log.php';
    $log = Log::singleton('file', '/var/log/nginx/xxx.log', '', array(), PEAR_LOG_INFO);
    // PREVIOUS CODE: Using error_log
    ini_set('error_log' , '/var/log/nginx/xxx.log');
    

    The new code should look like:

    // NEW CODE: using PEAR Log
    include '/usr/share/php/Log.php';
    $log = Log::singleton('syslog', LOG_USER, '/var/log/nginx/xxx.log', array(), PEAR_LOG_INFO);
    // NEW CODE: Using error_log
    ini_set(‘error_log’, ‘syslog’);
    openlog('/var/log/nginx/xxx.log', LOG_NDELAY, LOG_USER);
    

    If your FE servers and the Logging servers are all within the same EC2 security group, then there is no need to open the ports, since within the groups, all ports can be accessed freely, so long as a service is listening to it.

    This approach allows your each of your apps, modules to decide whether they want central logging or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ad-hoc deployment of my iOS game, which includes in-app purchase. It
I have an installer created using Visual Studio's Setup and Deployment that typically does
Going through happstack-lite tutorial : we build functions that have return type of ServerPart
going thru a tutorial on python lists,I tried to write a python function which
Going round in circles here i think. I have an activity called Locate; public
Going mad now. I have a MVC solution that i've upgraded from MVC 1
Going through the microsoft authentication tutorial listed here they have you create a master
I have created a clickonce deployment and published it to a website. I want
Im pretty new to CI so bear with me here. I have just setup
We have a huge ASP.NET web application which needs to be deployed to LIVE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.