You are viewing [info]bjs_redhat's journal

Oct. 23rd, 2009 @ 12:15 am Support 101: Logs and Pastebin
Current Location: United States, Texas, Alvin
Current Mood: awake


I am a member of various communities and I try to do my best to help people solve issues. I'm just a wannabe technologist and solutions provider and do my best to see people through solutions, regardless of distractions such as meta-discussions.

One issue I reguarly run into is that many people are hesitant to send me logs and information so I can pinpoint issues. I don't know if it's really hesitation but more of a matter that they have difficulty following my requests. So, while this might be taken as an insult by some, I'm only providing this as a step-by-step for others. Those who know me know I never talk down to anyone, but only shift down gears to provide complete details for those that honestly haven't done things before.

Hence the reasons for this hastily written "Support 101" entry.


An introduction to GNOME System Log Viewer

I use the GNOME desktop. Your desktop may vary. But for those that use GNOME, or have GNOME installed, there is a helpful, graphical user interface (GUI) log viewer known as, simply, the GNOME System Log Viewer. The location of the Log Viewer will vary based on your site's desktop menu, but by default, it should be under:
  • System -> Administration -> System Log
If you are not a privileged user (and you should not be, this isn't Windows where programs break if they aren't running as a privileged user), then you will most likely be prompted for the password of the "root" user. Figure 1 illustrates a typical prompt by the GNOME desktop.

gnome_query

Figure 1
: Administrative Privilege Query

If your distribution does not allow you to enter root credentials directly, then it may require use of the "sudo" command. In that case, open a command line interface (CLI) prompt and use the "sudo" command to execute the "gnome-system-log" command. E.g.,
  $ sudo gnome-system-log
  Password:  
You may have seen some uses of sudo to launch a full, privileged shell, such as illustrated in Figure 2.

gnome_cli

Figure 2: Full Administrative Privilege Shell in a typical Linux Command Line Interface (CLI) via Sudo

In any case, once the System Log Viewer launches. It shows a three (3) pane display of ...
  • List -- list of common files with relevant system information
  • Calendar -- when not grayed out, bolds the dates of entries in the current log view
  • View -- the contents of the log file
The main log of any POSIX system is its primary Syslog output file, which is /var/log/messages on Linux systems. Like most entries in the System Log Viewer, entries will be parsed by date and can be "folded" and "expanded" to hepl with organization. If you're like me, with a notebook computer, you're often booting every day. So the first entries for any day will often be the initial boot message when the system was first booted that day, as illustrated in Figure 3.

gnome_log_main

Figure 3: Main Syslog entries for Thursday, October 22nd, starting when the system was first booted at 1:46am.

Of special note is that fact that some logs are "rotated." E.g., in the case of /var/log/messages, older version of the log are named /var/log/messages.1, /var/log/messages.2, etc... This is the result of the typical logrotate configurations on most Linux systems. The System Log Viewer notes this and will list older versions in a pull down in the lower right corner, as illustrated in Figure 4. When accessed, the calendar will even bold the appropriate dates with entries in these older versions too, adding additional, visual information for quick notification.

gnome_log_version

Figure 4: The lower right pull-down menu with older log versions in the System Log Viewer.

Another important log is the X-window version 11 (X11) logs, typically the implementation from The X.org Foundation, and its /var/log/Xorg.0.log output. In this case, as illustrated in Figure 5, View -> Filter (also Ctrl-F key combination) was used to filter out all but lines with "DDC" (VESA Display Data Channel).

gnome_log_ddc

Figure 5: Filtering out lines by keywords in the System Log Viewer.


Directing output into a new/custom "log" file

Sometimes information will not be located in a log file or otherwise needs to be captured into a file or other form for use later. POSIX systems can utilize (as well as Windows, being that MS DOS 2.0 and later directly used SCO Xenix code to add) redirection of output to a file. Figure 6 illustrates redirection of the output of "lspci" into a file, and then the GNOME Editor is launched to view the file.
  $ lspci > /tmp/lspci ; gedit /tmp/lscpi &

gnome_cli_gedit

Figure 6: Redirecting command output to a file and viewing the file in the GNOME Editor.

Of course, this new file (/tmp/lspci) can be viewed in the System Log Viewer as well. It's as simple as using the menu:
  • File -> Open
  • Browse to file location (Filesystem -> /tmp)
  • Pick the file
Figure 7 illustrates the lspci output now viewed in the System Log Viewer, with all lines highlighted by clicking on the first line, then holding down the Shift key and clicking on the last line.

gnome_log_lspci

Figure 6: Viewing other/custom files in the System Log Viewer (with all lines highlighted in the view pane)


Uploading file contents to the Internet via Pastebin

Most forums have limited file attachment and/or viewing capabilities. When monospace and other attributes should to be retained in the original format, solutions like Pastebin should be utilized. Pastebin is a simple PHP program which allows file contents to be posted on the Internet and viewed, including options for formatting (such as programming language-specific syntax formatting). There is a public Pastebin.COM site where anyone can upload file contents, although organizations with more confidential information should consider setting up an internal server (only accessible via login, VPN, etc...).

After highlighting the contents of the custom lspci output file in Figure 6, the Edit -> Copy (also Ctrl-C) menu can be used to copy the contents of the file to the clipboard. Once copied to the clipboard, the contents can be pasted into a browser with Edit -> Paste (also Ctrl-V), such as one opened to Pastebin.COM as illustrated in Figure 7.

gnome_pastebin_paste

Figure 7: Pasting file contents into Pastebin

Pastebin (plus various Pastebin/PHP/Apache formatting extensions) supports many different syntax formatting options. If none are appropriate for the contents, the double at symbol (@@) can still be used as the preface for any line, which will highlight the entire line. As entered in Figure 7, and illustrated in the resulting output of Figure 8, the third (3rd) line is highlighted, which shows the display adapter in the lspci listing.

Note the resulting URL in the address line of the Browser of Figure 8. This is the URL to share the link to others in an e-mail or forum posting, so they can view the contents of the file. Also keep track of the link and your declared "Name" so it can be edited or deleted (browser settings or other session state permitting).

gnome_pastebin_sent

Figure 8: Pastebin output with custom URL and syntax formatting


I will be linking to this blog entry in the future.  I sincerely no one takes it as an insult and only as someone who honestly wants to help, especially getting those all-important logs and various command out that will tell me exactly where your issues lie.

About this Entry