If you're working as RHEL administrator, you might definitely heard about Sosreport - an extensible, portable and support data collection tool. It is a tool to collect system configuration details and diagnostic information from a Unix-like operating system. When the user raise a support ticket, he/she has to run this tool and send the resulting report generated by Sosreport tool to the Red Hat support executive. The executive will then perform an initial analysis based on the report and try to find what's the problem in the system. Not just on RHEL system, you can use it on any Unix-like operating systems for collecting system logs and other debug information.
Sosreport is available on Red Hat official systems, so you can install it using Yum Or DNF package managers as shown below.
$ sudo yum install sos
$ sudo dnf install sos
On Debian, Ubuntu and Linux Mint, run:
$ sudo apt install sosreport
Once installed, run the following command to collect your system configuration details and other diagnostic information.
$ sudo sosreport
You will be asked to enter some details of your system, such as system name, case id etc. Type the details accordingly, and press ENTER key to generate the report. If you don't want to change anything and want to use the default values, simply press ENTER.
Sample output from my CentOS 7 server:
sosreport (version 3.5) This command will collect diagnostic and configuration information from this CentOS Linux system and installed applications. An archive containing the collected information will be generated in /var/tmp/sos.DiJXi7 and may be provided to a CentOS support representative. Any information provided to CentOS will be treated in accordance with the published support policies at: https://wiki.centos.org/ The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party. No changes will be made to system configuration. Press ENTER to continue, or CTRL-C to quit. Please enter your first initial and last name [server.ostechnix.local]: Please enter the case id that you are generating this report for : Setting up archive ... Setting up plugins ... Running plugins. Please wait ... Running 73/73: yum... Creating compressed archive... Your sosreport has been generated and saved in: /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz The checksum is: 8f08f99a1702184ec13a497eff5ce334 Please send this file to your support representative.
If you don't want to be prompted for entering such details, simply use batch mode like below.
$ sudo sosreport --batch
As you can see in the above output, an archived report is generated and saved in /var/tmp/sos.DiJXi7 file. In RHEL 6/CentOS 6, the report will be generated in /tmp location. You can now send this report to your support executive, so that he can do initial analysis and find what's the problem.
You might be concerned or wanted to know what's in the report. If so, you can view it by running the following command:
$ sudo tar -tf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
$ sudo vim /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
Please note that above commands will not extract the archive, but only display the list of files and folders in the archive. If you want to view the actual contents of the files in the archive, first extract the archive using command:
$ sudo tar -xf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
All the contents of the archive will be extracted in a directory named "sosreport-server.ostechnix.local-20180628171844/" in the current working directory. Go to the directory and view the contents of any file using cat command or any other text viewer:
$ cd sosreport-server.ostechnix.local-20180628171844/
$ cat uptime 17:19:02 up 1:03, 2 users, load average: 0.50, 0.17, 0.10
For more details about Sosreport, refer man pages.
$ man sosreport
And, that's all for now. Hope this was useful. More good stuffs to come. Stay tuned!