Friday, 12 April 2019

How to retrieve the System Logs of our EC2 Server by Raj Gupta

System logs can help us in troubleshoot issues if our instance fails a status check. First we need to retrieve the system logs. The logs may contain an error that can help us troubleshoot the issue with our server without logging into it.



By using AWS EC2 console

Open EC2 console --> Select the instance --> Actions --> Instance Settings -->  Then click on Get System Log.


Then we will get output of our EC2 console like below without logging into it.


In this log we can get the region for issue with our server.
Some log data are below:-

[115879.769795] Out of memory: kill process 20273 (httpd) score 1285879

ERROR: mmu_update failed with rc=-22


By using AWS CLI:-

We need a system in which AWS CLI tool is already install then run the below command.

[root@ip-172-31-47-87 ~]# aws ec2 get-console-output --instance-id i-0c50c4c0c56fcb3a4

Then we will get log data of server in which have issue like below it will help us in troubleshoot.


{
    "InstanceId": "i-0c50c4c0c56fcb3a4",
    "Output": "[    0.000000] Linux version 4.14.77-70.59.amzn1.x86_64 (mockbuild@gobi-build-64001) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) #1 SMP Mon Nov 12 22:02:45 UTC 2018\r\n[    0.000000] Command line: root=LABEL=/ console=tty1 console=ttyS0 selinux=0 nvme_core.io_timeout=4294967295\r\n[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'\r\n[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'\r\n[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'\r\n[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256\r\n[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.\r\n[    0.000000] e820: BIOS-provided physical RAM map:\r\n[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable\r\n[    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009ffff] reserved\r\n[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved\r\n[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffffff] usable\r\n[    0.000000] BIOS-e820: [mem 0x00000000fc000000-0x00000000ffffffff] reserved\r\n[    0.000000] NX (Execute Disable) protection: active\r\n[    0.000000] SMBIOS 2.7 present.\r\n[    0.000000] DMI: Xen HVM domU, BIOS 4.2.amazon 08/24/2006\r\n[    0.000000] Hypervisor detected: Xen HVM\r\n[    0.000000] Xen version 4.2.\r\n[    0.000000] Netfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated NICs.\r\n[    0.000000] Blkfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated disks.\r\n[    0.000000] You might have to change the root device\r\n[    0.000000] from /dev/hd[a-d] to /dev/xvd[a-d]\r\n[    0.000000] in your root= kernel command line option\r\n[    0.000000] tsc: Fast TSC calibration using PIT\r\n


No comments:

Post a Comment