Manage node logs

Managing logs is an optional but recommended step when running a Redbelly node.

In order for our team to provide help and support to you in case any issue occurs while running the node you need to enable cloud logging using services like AWS Cloud Watch.

Assuming you have been logged in from an administrator user account named ubuntu the following steps will assist you in setting up cloud logging.


Step 1: Install aws cli v2

Install aws cli v2 with following commands:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin

Step 2: Install amazon-cloudwatch-agent

Install amazon-cloudwatch-agent with following commands:

ip: <ENTER FULLY QUALIFIED DOMAIN NAME (FQDN) HERE>
id: <ENTER THE ID PROVIDED POST REGISTRATION HERE - See section 'Node Registration'>
genesisContracts:
  bootstrapContractsRegistryAddress: 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5
consensusPort: 1888
grpcPort: 1111
privateKeyHex:<Private_key_for_signing_address>
poolConfig:
  initCap: 5
  maxCap: 30
  idleTimeout: 180
clientKeepAliveConfig:
  keepAliveTime: 1
  keepAliveTimeOut: 20
serverKeepAliveConfig:
  serverKeepAliveTime: 70
  serverKeepAliveTimeOut: 10
  minTime: 60
rpcPoolConfig:
  maxOpenCount: 1
  maxIdleCount: 1
  maxIdleTime: 30

Step 3: Create cloudwatch-agent config file

Create a cloud watch agent file in /home/ubuntu/config.json

{
    "agent": {
        "metrics_collection_interval": 10,
        "logfile": "/home/ubuntu/amazon-cloudwatch-agent.log",
        "run_as_user": "root"
    },
    "logs": {
        "logs_collected": {
            "files": {
                "collect_list": [
                    {
                        "file_path": "/home/ubuntu/logs/rbbcLogs",
                        "log_group_name": "{hostname}",
                        "log_stream_name":"redbelly-logs",
                        "timezone": "Local"
                    }
                ]
            }
        }
    }
}

Step 4: Setup logs

The target location will be ec2 in the case of AWS, on-premise in the case of other cloud platforms, or your physical server.

aws configure set aws_access_key_id <ENTER AWS ACCESS KEY ID> --profile AmazonCloudWatchAgent
aws configure set aws_secret_access_key <ENTER AWS SECRET ACCESS KEY> --profile AmazonCloudWatchAgent
aws configure set region <ENTER AWS REGION> --profile AmazonCloudWatchAgent
aws configure set output <ENTER AWS OUTPUT> --profile AmazonCloudWatchAgent

touch /home/ubuntu/amazon-cloudwatch-agent.log
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m <Enter target location> -c file:/home/ubuntu/config.json -s