当前位置: 首页>>代码示例>>Java>>正文


Java Match.isNull方法代码示例

本文整理汇总了Java中oi.thekraken.grok.api.Match.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java Match.isNull方法的具体用法?Java Match.isNull怎么用?Java Match.isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oi.thekraken.grok.api.Match的用法示例。


在下文中一共展示了Match.isNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseLine

import oi.thekraken.grok.api.Match; //导入方法依赖的package包/类
public Map<String, Object> parseLine(String fileName, int lineNum, String line) throws Exception {
  if (line == null || line.isEmpty())
    return null;

  Match gm = grok.match(line);
  gm.captures();

  if (gm.isNull())
    return null;

  Map<String,Object> grokMap = gm.toMap();

  // add the ISO-8601 timestamp field if was requested in the config
  if (timestampFieldName != null) {
    Date timestamp = getLogDate(grokMap);
    if (timestamp != null) {
      grokMap.put(timestampFieldName, iso8601.get().format(timestamp));
    }
  }

  return grokMap;
}
 
开发者ID:lucidworks,项目名称:storm-solr,代码行数:23,代码来源:GrokLogLineParser.java

示例2: parseLine

import oi.thekraken.grok.api.Match; //导入方法依赖的package包/类
public Map<String, Object> parseLine(String fileName, int lineNum, String line) throws Exception {
  if (line == null || line.isEmpty())
    return null;

  Match gm = grok.match(line);
  gm.captures();

  if (gm.isNull()){
    if (unmatchedLineName != null && unmatchedLineName.isEmpty() == false){
      return Collections.<String, Object>singletonMap(unmatchedLineName, line);
    } else {
      return null;
    }
  }

  Map<String,Object> grokMap = gm.toMap();

  // add the ISO-8601 timestamp field if was requested in the config
  if (timestampFieldName != null) {
    Date timestamp = getLogDate(grokMap);
    if (timestamp != null) {
      grokMap.put(timestampFieldName, iso8601.get().format(timestamp));
    }
  }

  return grokMap;
}
 
开发者ID:lucidworks,项目名称:fusion-log-indexer,代码行数:28,代码来源:GrokLogLineParser.java

示例3: getCurrentRecord

import oi.thekraken.grok.api.Match; //导入方法依赖的package包/类
public Map<String, Object> getCurrentRecord() {
    Match gm = grok.match(currentLine);
    gm.captures();
    if (gm.isNull()) {
        throw new GrokRecordValidateException("Couldn't parse line");
    }
    return gm.toMap();
}
 
开发者ID:arielnetworks,项目名称:embulk-parser-grok,代码行数:9,代码来源:GrokRecordIterator.java

示例4: afterAllLinesRead

import oi.thekraken.grok.api.Match; //导入方法依赖的package包/类
@Override
public void afterAllLinesRead(Map<String, Object> mutable) {
  mutable.remove("SECOND");
  mutable.remove("MONTHNUM");
  mutable.remove("YEAR");
  mutable.remove("MONTHDAY");
  String pat = grok.getOriginalGrokPattern();
  mutable.remove(pat.substring(2, pat.length() - 1));

  // try to break out the mdc context if available
  String mdc = (String)mutable.get("mdc_s");
  if (mdc != null)
    unpackMdcInfo(mdc, mutable);

  // if this message looks like a request message (such as a query), try to parse out the additional fields
  String category = (String)mutable.get("category_s");
  String message = (String)mutable.get(logMessageFieldName);
  if (("o.a.s.c.S.Request".equals(category) || "org.apache.solr.core.SolrCore".equals(category)) && message != null) {
    // see if this request line matches the Solr request format to parse out additional fields like query params

    String requestPart = message.replaceAll("\\s+"," ").trim();
    Match requestMatch = requestGrok.match(requestPart);
    requestMatch.captures();
    if (!requestMatch.isNull()) {
      Map<String,Object> requestMap = requestMatch.toMap();
      requestMap.remove("logmessage");
      requestMap.remove("BASE10NUM");
      String rpat = requestGrok.getOriginalGrokPattern();
      requestMap.remove(rpat.substring(2,rpat.length()-1));
      mutable.putAll(requestMap);

      if (parseParams) {
        String params_s = (String)requestMap.get("params_s");
        if (params_s != null) {
          String[] pairs = params_s.split("&");
          for (String nvp : pairs) {
            int eqAt = nvp.indexOf("=");
            if (eqAt != -1) {
              String key = nvp.substring(0,eqAt);
              String value = nvp.substring(eqAt+1);
              if (!"_".equals(key)) {
                if (!key.endsWith("_s")) {
                  key += "_s";
                }
                mutable.put(key, value);
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:lucidworks,项目名称:fusion-log-indexer,代码行数:54,代码来源:SolrLogParser.java


注:本文中的oi.thekraken.grok.api.Match.isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。