2015-11-28 5 views
9

単純なユースケースのようですが、何らかの理由でこれを行う方法やGoogleの明確な例はわかりません。木場:特定のフレーズを検索して結果を返します。別の検索でフレーズを返します。

は私がlogstash メッセージに格納されたメッセージを考えてみましょう:

「情報:2015年11月28日22:02:19232:共通:INFO:ENV:生産 ユーザー:なし:ユーザー名:なし:「

そして、私はフレーズをkibana(バージョン4)で検索したい:」バスへの公開:LOGパブリッシングバスへの」 私は結果 のセットを取得します。しかし、私は検索しますならば"なし:LOG:バスに公開する" "結果が見つかりません"と表示されます。

明らかにこのフレーズは存在し、以前の検索で返されます。

私の質問は基本的に - 何が起こっているのですか?可能な長いフレーズを検索する正しい方法と、2番目の例が失敗するのはなぜですか。

EDIT: 保存されたJSON。

{ 
    "_index": "logz-ngdxrkmolklnvngumaitximbohqwbocg-151206_v1", 
    "_type": "django_logger", 
    "_id": "AVF2DPxZZst_8_8_m-se", 
    "_score": null, 
    "_source": { 
    "log": " publishing to bus {'user_id': 8866, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}", 
    "logger": "common", 
    "log_level": "INFO", 
    "message": "2015-12-06 06:47:21,298:common:INFO:ENV: Production User:None:Username:None:LOG: publishing to bus {'user_id': 8866, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}", 
    "type": "django_logger", 
    "tags": [ 
     "celery" 
    ], 
    "path": "//path/to/logs/out.log", 
    "environment": "Staging", 
    "@timestamp": "2015-12-06T06:47:21.298+00:00", 
    "user_id": "None", 
    "host": "path.to.host", 
    "timestamp": "2015-12-06 06:47:21,298", 
    "username": "None" 
    }, 
    "fields": { 
    "@timestamp": [ 
     1449384441298 
    ] 
    }, 
    "highlight": { 
    "message": [ 
     "2015-12-06 06:47:21,298:common:INFO:ENV: Staging User:None:Username:None:LOG: @[email protected]@/[email protected] @[email protected]@/[email protected] @[email protected]@/[email protected] {'user_id': **, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}" 
    ] 
    }, 
    "sort": [ 
    1449384441298 
    ] 
} 
+0

「none:log:publishing to bus」を試しましたか? –

+0

今試しました。結果を返さない – alonisser

+0

':'は特殊文字です。それをエスケープしてみてください: '\:' – xjedam

答えて

0

キバナには、次のような特殊文字を含むいくつかの問題があります。および - 。木場がそのような性格を見つけたとき、彼らは同じ分野ではなく、別の場所に保存されます。そのためには、バスへのパブリッシングやNoneまたはLogを簡単に見つけることができます。解決策は、フィールドが分​​析されないことをキバナに示す必要があるということです。

+0

これは実際の回答ではありません。すべてのそれらの文字は単一の木場のフィールドに存在します。木場に保管されている未加工のjsonを質問に追加して、そのことを実証してみよう – alonisser

+0

シンプルなフィドドとして見えますが、実際にはそのフィールドでそのように動作しません。そのフィールドを解析されていないフィールドとして渡すようにしてください。 – Deckard27

+0

格納されているものと索引付けされているものは、2つの異なるものです。以前にリクエストされたとおり、マッピングを投稿できますか? –

1

弾性検索に準じて、標準アナライザをデフォルトで使用します。次のように標準アナライザは、メッセージフィールドをトークン化:

「2015年12月6日06:21298:47共通:INFO:ENV:生産 ユーザー:なし:ユーザー名:なし:LOGません:バスへの公開{ 'u'EURUSD':10進数( '1.061025')、u'GBPUSD ':' user_id ':8866、 ' event_id ':' aibRBPcLxcAzsEVRtFZVU5 '、'タイムスタンプ ':1449384441、 '引用符 ':{ : 進数( '1.494125')、u'EURGBP ':10進数(' 0.710150' )}、 'イベント' 'AccountInstrumentsUpdated'、 '分':1449384420}」

{ 
    "tokens": [ 
    { 
     "token": "2015", 
     "start_offset": 0, 
     "end_offset": 4, 
     "type": "<NUM>", 
     "position": 0 
    }, 
    { 
     "token": "12", 
     "start_offset": 5, 
     "end_offset": 7, 
     "type": "<NUM>", 
     "position": 1 
    }, 
    { 
     "token": "06", 
     "start_offset": 8, 
     "end_offset": 10, 
     "type": "<NUM>", 
     "position": 2 
    }, 
    { 
     "token": "06", 
     "start_offset": 11, 
     "end_offset": 13, 
     "type": "<NUM>", 
     "position": 3 
    }, 
    { 
     "token": "47", 
     "start_offset": 14, 
     "end_offset": 16, 
     "type": "<NUM>", 
     "position": 4 
    }, 
    { 
     "token": "21,298", 
     "start_offset": 17, 
     "end_offset": 23, 
     "type": "<NUM>", 
     "position": 5 
    }, 
    { 
     "token": "common:info:env", 
     "start_offset": 24, 
     "end_offset": 39, 
     "type": "<ALPHANUM>", 
     "position": 6 
    }, 
    { 
     "token": "production", 
     "start_offset": 41, 
     "end_offset": 51, 
     "type": "<ALPHANUM>", 
     "position": 7 
    }, 
    { 
     "token": "user:none:username:none:log", 
     "start_offset": 52, 
     "end_offset": 79, 
     "type": "<ALPHANUM>", 
     "position": 8 
    }, 
    { 
     "token": "publishing", 
     "start_offset": 81, 
     "end_offset": 91, 
     "type": "<ALPHANUM>", 
     "position": 9 
    }, 
    { 
     "token": "to", 
     "start_offset": 92, 
     "end_offset": 94, 
     "type": "<ALPHANUM>", 
     "position": 10 
    }, 
    { 
     "token": "bus", 
     "start_offset": 95, 
     "end_offset": 98, 
     "type": "<ALPHANUM>", 
     "position": 11 
    }, 
    { 
     "token": "user_id", 
     "start_offset": 100, 
     "end_offset": 107, 
     "type": "<ALPHANUM>", 
     "position": 12 
    }, 
    { 
     "token": "8866", 
     "start_offset": 109, 
     "end_offset": 113, 
     "type": "<NUM>", 
     "position": 13 
    }, 
    { 
     "token": "event_id", 
     "start_offset": 115, 
     "end_offset": 123, 
     "type": "<ALPHANUM>", 
     "position": 14 
    }, 
    { 
     "token": "aibrbpclxcazsevrtfzvu5", 
     "start_offset": 125, 
     "end_offset": 147, 
     "type": "<ALPHANUM>", 
     "position": 15 
    }, 
    { 
     "token": "timestamp", 
     "start_offset": 149, 
     "end_offset": 158, 
     "type": "<ALPHANUM>", 
     "position": 16 
    }, 
    { 
     "token": "1449384441", 
     "start_offset": 160, 
     "end_offset": 170, 
     "type": "<NUM>", 
     "position": 17 
    }, 
    { 
     "token": "quotes", 
     "start_offset": 172, 
     "end_offset": 178, 
     "type": "<ALPHANUM>", 
     "position": 18 
    }, 
    { 
     "token": "rates", 
     "start_offset": 184, 
     "end_offset": 189, 
     "type": "<ALPHANUM>", 
     "position": 19 
    }, 
    { 
     "token": "ueurusd", 
     "start_offset": 192, 
     "end_offset": 199, 
     "type": "<ALPHANUM>", 
     "position": 20 
    }, 
    { 
     "token": "decimal", 
     "start_offset": 201, 
     "end_offset": 208, 
     "type": "<ALPHANUM>", 
     "position": 21 
    }, 
    { 
     "token": "1.061025", 
     "start_offset": 209, 
     "end_offset": 217, 
     "type": "<NUM>", 
     "position": 22 
    }, 
    { 
     "token": "ugbpusd", 
     "start_offset": 220, 
     "end_offset": 227, 
     "type": "<ALPHANUM>", 
     "position": 23 
    }, 
    { 
     "token": "decimal", 
     "start_offset": 229, 
     "end_offset": 236, 
     "type": "<ALPHANUM>", 
     "position": 24 
    }, 
    { 
     "token": "1.494125", 
     "start_offset": 237, 
     "end_offset": 245, 
     "type": "<NUM>", 
     "position": 25 
    }, 
    { 
     "token": "ueurgbp", 
     "start_offset": 248, 
     "end_offset": 255, 
     "type": "<ALPHANUM>", 
     "position": 26 
    }, 
    { 
     "token": "decimal", 
     "start_offset": 257, 
     "end_offset": 264, 
     "type": "<ALPHANUM>", 
     "position": 27 
    }, 
    { 
     "token": "0.710150", 
     "start_offset": 265, 
     "end_offset": 273, 
     "type": "<NUM>", 
     "position": 28 
    }, 
    { 
     "token": "event", 
     "start_offset": 277, 
     "end_offset": 282, 
     "type": "<ALPHANUM>", 
     "position": 29 
    }, 
    { 
     "token": "accountinstrumentsupdated", 
     "start_offset": 284, 
     "end_offset": 309, 
     "type": "<ALPHANUM>", 
     "position": 30 
    }, 
    { 
     "token": "minute", 
     "start_offset": 311, 
     "end_offset": 317, 
     "type": "<ALPHANUM>", 
     "position": 31 
    }, 
    { 
     "token": "1449384420", 
     "start_offset": 319, 
     "end_offset": 329, 
     "type": "<NUM>", 
     "position": 32 
    } 
    ] 
} 

フレーズ「製作ユーザー:なし:ユーザー名:なし:LOGません:バスへの公開」「バスに発行」

{ 
     "token": "production", 
     "start_offset": 41, 
     "end_offset": 51, 
     "type": "<ALPHANUM>", 
     "position": 7 
    }, 
    { 
     "token": "user:none:username:none:log", 
     "start_offset": 52, 
     "end_offset": 79, 
     "type": "<ALPHANUM>", 
     "position": 8 
    }, 
    { 
     "token": "publishing", 
     "start_offset": 81, 
     "end_offset": 91, 
     "type": "<ALPHANUM>", 
     "position": 9 
    }, 
    { 
     "token": "to", 
     "start_offset": 92, 
     "end_offset": 94, 
     "type": "<ALPHANUM>", 
     "position": 10 
    }, 
    { 
     "token": "bus", 
     "start_offset": 95, 
     "end_offset": 98, 
     "type": "<ALPHANUM>", 
     "position": 11 
    } 

あなたが検索した場合は、elasticsearchは、上記の3つのトークンと一致し、文書を返します。

"None:LOG:publishing to bus" "None:LOG:"が完全に一致しないため、ドキュメントを返さない。

「User:None:Username:None:LOG:publishing to bus」と試してみてください。

+0

解決策は、文字を再配置することです。文字_または索引では、フィールドが分​​析されていないフィールドであることを示します。 – Deckard27

関連する問題