Package org.apache.storm.daemon.logviewer.handler

## Class LogviewerLogSearchHandler

- java.lang.Object
- - org.apache.storm.daemon.logviewer.handler.LogviewerLogSearchHandler

-     public class LogviewerLogSearchHandler
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `LogviewerLogSearchHandler.Matched` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `GREP_BUF_SIZE` |
    `static int` | `GREP_CONTEXT_SIZE` |
    `static int` | `GREP_MAX_SEARCH_SIZE` |
    `static Pattern` | `WORKER_LOG_FILENAME_PATTERN` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LogviewerLogSearchHandler​(Map<String,​Object> stormConf, Path logRoot, Path daemonLogRoot, ResourceAuthorizer resourceAuthorizer, StormMetricsRegistry metricsRegistry)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `jakarta.ws.rs.core.Response` | `deepSearchLogsForTopology​(String topologyId, String user, String search, String numMatchesStr, String portStr, String fileOffsetStr, String offsetStr, Boolean searchArchived, String callback, String origin)` | Advanced search across worker log files in a topology.
    `jakarta.ws.rs.core.Response` | `searchLogFile​(String fileName, String user, boolean isDaemon, String search, String numMatchesStr, String offsetStr, String callback, String origin)` | Search from a worker log file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### GREP_MAX_SEARCH_SIZE

          public static final int GREP_MAX_SEARCH_SIZE

      See Also:
        Constant Field Values

    - #### GREP_BUF_SIZE

          public static final int GREP_BUF_SIZE

      See Also:
        Constant Field Values

    - #### GREP_CONTEXT_SIZE

          public static final int GREP_CONTEXT_SIZE

      See Also:
        Constant Field Values

    - #### WORKER_LOG_FILENAME_PATTERN

          public static final Pattern WORKER_LOG_FILENAME_PATTERN

  - ### Constructor Detail

    - #### LogviewerLogSearchHandler

          public LogviewerLogSearchHandler​(Map<String,​Object> stormConf,
                                           Path logRoot,
                                           Path daemonLogRoot,
                                           ResourceAuthorizer resourceAuthorizer,
                                           StormMetricsRegistry metricsRegistry)

      Constructor.
      Parameters:
        `stormConf` - storm configuration
        `logRoot` - log root directory
        `daemonLogRoot` - daemon log root directory
        `resourceAuthorizer` - `ResourceAuthorizer`
        `metricsRegistry` - The logviewer metrics registry

  - ### Method Detail

    - #### searchLogFile

          public jakarta.ws.rs.core.Response searchLogFile​(String fileName,
                                                           String user,
                                                           boolean isDaemon,
                                                           String search,
                                                           String numMatchesStr,
                                                           String offsetStr,
                                                           String callback,
                                                           String origin)
                                                    throws IOException,
                                                           InvalidRequestException

      Search from a worker log file.
      Parameters:
        `fileName` - log file
        `user` - username
        `isDaemon` - whether the log file is regarding worker or daemon
        `search` - search string
        `numMatchesStr` - the count of maximum matches
        `offsetStr` - start offset for log file
        `callback` - callbackParameterName for JSONP
        `origin` - origin
      Returns:
        Response containing JSON content representing search result
      Throws:
        `IOException`
        `InvalidRequestException`

    - #### deepSearchLogsForTopology

          public jakarta.ws.rs.core.Response deepSearchLogsForTopology​(String topologyId,
                                                                       String user,
                                                                       String search,
                                                                       String numMatchesStr,
                                                                       String portStr,
                                                                       String fileOffsetStr,
                                                                       String offsetStr,
                                                                       Boolean searchArchived,
                                                                       String callback,
                                                                       String origin)
                                                                throws IOException

      Advanced search across worker log files in a topology.
      Parameters:
        `topologyId` - topology ID
        `user` - username
        `search` - search string
        `numMatchesStr` - the count of maximum matches. Note that this number is with respect to each port, not to each log or each search request
        `portStr` - worker port, null or '*' if the request wants to search from all worker logs
        `fileOffsetStr` - index (offset) of the log files
        `offsetStr` - start offset for log file
        `searchArchived` - true if the request wants to search also archived files, false if not
        `callback` - callbackParameterName for JSONP
        `origin` - origin
      Returns:
        Response containing JSON content representing search result
      Throws:
        `IOException`