Collect Management Node Logs Using a Log Server

About this task

For scenarios requiring collection of management node logs through a log server to analyze the Cloud health status, you can use the following solution.

You need to deploy the latest ZStack Cloud environment and a Syslog log server.

The detailed procedure is as follows:
  1. Configure the syslog server on your log server.
  2. Add a log server to the Cloud.
  3. Verify the log server.

Procedure

  1. Configure the syslog server on your log server.

    You need to prepare a log server for receiving log information in advance, and ensure that the syslog server is installed on it.

    • On the log server, perform the following configurations:
      1. Open the /etc/rsyslog.conf file and locate the following commands:
        #$ModLoad imudp #$UDPServerRun 514
        Modify preceding commands to the following to enable UDP configuration:
        $ModLoad imudp $UDPServerRun 514
      2. Add the following command to set the log facility (This scenario chooses LOCAL1):
        local1.*   /var/log/test.log
      3. Save the configuration and run the following command to restart the syslog service:
        systemctl restart rsyslog
      Figure 1. Configure Syslog Server


    Note: If the Cloud UI reports a Log server unreachable error during log server addition, you need to run the following command on the log server to enable 7/tcp port listening for Inet Address isReachable:
    iptables -I INPUT -p tcp --dport 7 -j ACCEPT
    or run:
    firewall-cmd --zone=public --add-port=7/tcp --permanent
  2. Add a log server to the Cloud.
    On the main menu of ZStack Cloud, choose Settings > Platform Setting > Log Server. Then the Log Server page is displayed. Click Add Log Server. On the displayed page, set the following parameters:
    • Name: Enter a name for the log server. The name must be 1 to 128 characters in length and can contain Chinese characters, letters, digits, spaces, hyphens (-), underscores (_), periods (.), parenthesis (), colons (:), and plus signs (+) and cannot begin or end with spaces.
    • Description: Optional. Enter a description for the log server.
    • Log Type: Select Management Node Log.
    • Output: Select the output type. Only Syslog is supported.
    • Address: Enter the server address. You can enter an IP address, domain name, or URL pattern.
    • Port: Enter a port to provide services.
    • Protocol: Select the data transfer protocol. In this scenario, select UDP.
    • Log Facility: Select a log facility category. Valid values: LOCAL0 to LOCAL7.
      Note:
      • Select a value that is consistent with the log identifier you configure in the rsylog.conf file of the log server. Then, the Cloud can send logs correctly to this server.
      • For this scenario, the log facility in rsyslog.conf is set to LOCAL1, so enter LOCAL1 here.
    • Log Severity Level: Select a log severity level. Valid values from lowest to highest: ALL, TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
      Note: Only logs of this level or higher levels will be received by the log server.
      • For example, if you select the severity level as WARN, the log server can receive logs of the WARN level and higher levels (ERROR and FATAL).
      • If you select the severity level as ALL, the log server receives logs of all levels.
    Figure 2. Add Management Node Log Server


  3. Verify the log server.
    After configuration, run the following command on the log server to check if it receives management node logs:
    cat /var/log/test.log
    Figure 3. View Management Node Logs


    The log server successfully receives management node logs. The configuration works.

Collect Platform Operation Logs Using a Log Server

About this task

A project requires a log server to collect platform operation logs for auditing project member activities.

The following table lists sample configurations for visualization analysis on the collected logs:
Configuration Item Configuration Details
Project Name Project-1
User Name User-1
Log Server Type Loki
Log Server IP 172.xx.xx.145
Log Server Port 3100
Visualization Tool Grafana
You can use the solution described in this chapter. The procedure is as follows:
  1. Prepare the Loki log server.
  2. Connect the Loki log server to the Cloud.
  3. Set up Grafana and connect it to the Loki log server.
  4. Collect platform operation logs.

Procedure

  1. Prepare the Loki log server.

    Set up a log server in advance to receive logs. In this scenario, use a Loki log server.

  2. Connect the Loki log server to the Cloud.
    Log in to ZStack Cloud as project member User-1. On the main menu, choose Settings > Platform Setting > Log Server. On the Log Server page, click Add Log Server. Then the Add Log Server page is displayed.
    Note: Ensure the project member has log server operation permissions.
    On the displayed page, set the following parameters:
    • Name: Enter a name for the log server. The name must be 1 to 128 characters in length and can contain Chinese characters, letters, digits, spaces, hyphens (-), underscores (_), periods (.), parenthesis (), colons (:), and plus signs (+) and cannot begin or end with spaces.
    • Description: Optional. Enter a description for the log server.
    • Log Type: Select Cloud Operation Log.
    • Output: Select the output type. In this scenario, select Loki.
    • Address: Enter the log server address. You can enter an IP address, domain name, or URL pattern. In this scenario, enter 172.xx.xx.145.
    • Port: Enter a port to provide services. In this scenario, enter 3100.
    • Labels Job: Add job labels to logs. You can use this label to quickly filter logs on the log server. In this scenario, enter job=project-1.
    • TLS: Choose whether to enable Transport Layer Security (TLS). In this scenario, disable the switch.
    • User name: Optional. Enter the user name for identity authentication. Leave blank in this scenario.
    • Password: Optional. Enter the password corresponding to the user name. Leave blank in this scenario.
    Figure 1. Add Loki Log Server


  3. Set up Grafana and connect it to the Loki log server.
    1. Deploy Grafana.
      Set up the Grafana application. You can deploy it manually or through the ZStack Cloud Application Market.
      To deploy through ZStack Cloud Application Market:
      1. Log in using the admin account.
      2. On the main menu of ZStack Cloud, choose Operational Management > Application Market > Default Application > All.
      3. Locate Grafana and click Install Application.
      Figure 2. Install Grafana through Application Market


    2. Connect to the Loki log server in Grafana.

      Log in to Grafana. When installed via Application Market, use the default credentials:

      • User name: admin.
      • Password: ZStack@123.
      On the Grafana main menu, choose Connection > Data Sources

      On the Data Sources page, click Add new data source and select Loki as the type.

      Set the following parameters:
      • Name: Enter a data source name. In this scenario, enter loki-172.xx.xx.145.
      • URL: Enter the full log server URL. In this scenario, enter http://172.xx.xx.145:3100.
      Configure other options as needed.
      Figure 3. Connect to Loki in Grafana


  4. Collect platform operation logs.

    On the Grafana main menu, click Explore. On the Explore page:

    1. Select the connected Loki-172.xx.xx.145 log server.
    2. Set Label filters to job=project-1.
    3. Click Run query to view Project-1's platform operation logs.
    Figure 4. View Logs


What to do next

You have now completed collecting platform operation logs through the Loki server.

Archives

Download Document Archives

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.