2014-12-29 23 views
5

Tüm sorgu deyimini Neo4j sunucusuna günlüğe kaydetmek istiyorum, ancak SO &'u aradıktan sonra başarısız oldum. Bu SO sorusunu Rest Queries Logged on Neo4j Server buldum, ancak bu konfigürasyon ayarlarını değiştirdiğimde umduğum şey elde edilemedi. Neo4j sürüm 2.1.5 REST API ile iletişim kurmak için Go-CQ kitaplığı kullanarak Golang & çalışıyorum.Neo4j sunucusuna sorgu ifadesi nasıl kaydedilir, bu mümkün mü?

Aradığım şey, ideal olarak, geçirilmekte olan parametrelerle gerçekleştirilmekte olan gerçek sorgudur. Bu bilgiyi kayıt altına almak mümkün mü? Herhangi bir yardım büyük takdir, teşekkür ederim!

cevap

10

Aşağıdakiler, sorguları + params + sonuçlarını da içeren http logging hakkındadır. Sadece hata ayıklama ve test etme için üretim ayarlarına yönelik değildir.

Bu 2.1.6 den çalışmalı, bkz: https://github.com/neo4j/neo4j/pull/3399

Bu, şu anda ayarlayarak etkinleştirilir:

org.neo4j.server.http.unsafe.content_log.enabled=true 

ayarı yanında:

org.neo4j.server.http.log.enabled=true 

conf/neo4j-server.properties yılında ve çoğaltarak tüm istekleri ve yanıtları göndermek için desen (conf/neo4j-http-logging.xml):

bu gibi içerikle, bir data/log/http.log dosyada sonuçlanacaktır

<configuration> 
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>data/log/http.log</file> 
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
     <fileNamePattern>data/log/http.%d{yyyy-MM-dd_HH}.log</fileNamePattern> 
     <maxHistory>30</maxHistory> 
    </rollingPolicy> 

    <encoder> 
     <!-- Note the deliberate misspelling of "referer" in accordance with RFC1616 --> 
     <pattern>%h %l %user [%t{dd/MMM/yyyy:HH:mm:ss Z}] "%r" %s %b "%i{Referer}" "%i{User-Agent}" \nRequest:\n%fullRequest\nResponse:\n%fullResponse</pattern> 
    </encoder> 
    </appender> 

    <appender-ref ref="FILE"/> 
</configuration> 

yılında

<pattern>%fullRequest\n\n%fullResponse</pattern> 

Tam bölümü:

127.0.0.1 - - [04/Jan/2015:11:23:50 +0100] "POST /db/data/transaction/commit HTTP/1.1" 200 372 "http://localhost:7474/browser/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36" 
Request: 
POST /db/data/transaction/commit HTTP/1.1 
Origin: http://localhost:7474 
X-stream: true 
Cookie: SQLiteManager_currentLangue=4; __jrDevToolbarSessionId=0x1.b6e143f2c334p-3; JSESSIONID=1AFCE7DCF2D5D7134E933871EBF88252; OSESSIONID=OS1412075842834-2614241454738785158; connect.sid=s%3AkRY6%2B4RyW%2FC2ZUMjfIVqtRRo.shdI5G0zTKSq%2BzKevgXzLEdHnwjUDYP1JFlOhupRf2I; _ga=GA1.1.149316633.1397859613; _mkto_trk=id:773-GON-065&token:_mch-localhost-1384123755719-53900; undefined=0; __atuvc=0%7C47%2C0%7C48%2C1%7C49%2C5%7C50%2C13%7C51 
Accept: application/json, text/plain, */* 
Connection: keep-alive 
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 
Referer: http://localhost:7474/browser/ 
Host: localhost:7474 
DNT: 1 
Accept-Encoding: gzip, deflate 
Accept-Language: en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4 
Content-Length: 115 
Content-Type: application/json;charset=UTF-8 

{"statements":[{"statement":"match (n) return count(*)","resultDataContents":["row","graph"],"includeStats":true}]} 
Response: 
HTTP/1.1 200 OK 
Access-Control-Allow-Origin: * 
Content-Type: application/json 

{"results":[{"columns":["count(*)"],"data":[{"row":[0],"graph":{"nodes":[],"relationships":[]}}],"stats":{"contains_updates":false,"nodes_created":0,"nodes_deleted":0,"properties_set":0,"relationships_created":0,"relationship_deleted":0,"labels_added":0,"labels_removed":0,"indexes_added":0,"indexes_removed":0,"constraints_added":0,"constraints_removed":0}}],"errors":[]} 
+0

Çok teşekkürler Michael! – evkline

İlgili konular