Finding Information in the Log

The AMPS log is one of the most useful places to find information when there's a problem with your application. Here are some techniques to use for finding relevant information in the log:

  • Ensure the log is capturing information that will be useful for diagnosing the problem. In general production use, 60East recommends logging at info level (or more verbose). To fully troubleshoot an error, it may be necessary to log at trace level to see the exact behavior in AMPS. Some deployments may find it useful to keep a separate log at warning level and above to more easily detect errors and potential problems, while maintaining an info level log for being able to troubleshoot problems.

  • To find log messages that may indicate a problem, use amps-grep or the Linux grep tool to find log messages at warning, error, critical, or emergency levels. For example, you might use the following command line:

    amps-grep -E 'warning|error|critical|emergency' log_file


    grep -E 'warning|error|critical|emergency' log_file

    This will show lines from the log that contain messages logged at those levels. The text that AMPS uses for log messages is guaranteed not to include strings that duplicate one of the log levels, although information that you configure (such as client names, topic names, and so on) may contain those strings.

  • If you know the name of the client that experienced the problem, you can use that name to get information about the client. It's often helpful to get log messages that include the client name and several lines of output after the client name to help you understand the context in which AMPS produced the message for the client name. To do this, you might you use the following command line:

    amps-grep client_name log_file


    grep –B2 –A10 client_name log_file

This command line looks for all occurrences of the client_name in the log file. The amps-grep version prints the full messages where the client_name appears. The grep version attempts to approximate this by printing two lines of context before the line that contains the client name, and ten lines of context after the line that contains the client name.

Once you've found the information you're looking for, the ampserr utility can help you look up more information on messages, as described in Looking up Errors with ampserr.

Last updated

Copyright 2013-2024 60East Technologies, Inc.