转储事务日志的内容
如果需要查看事务日志,特别是为了查看某个节点或关系(或属性)何时被访问,您需要使用 DumpLogicalLog
工具转储日志。
在 3.5.x 版本之前,这些工具可在 Maven 中央仓库 中单独获取。从那里下载(或构建)适合您 Neo4j 版本的正确工具 jar 文件。
将 jar 文件放在 $NEO4J_HOME\lib
中,并以 neostore.transaction.db.1 为例运行以下命令
For 3.5 and lower
----
$ java -cp 'lib/*:system/lib/*:/usr/share/neo4j/lib/*' org.neo4j.tools.dump.DumpLogicalLog ./data/graph.db/neostore.transaction.db.1 > /tmp/dumptxlog_1.log
----
For 4.0 and higher
----
$ java -cp 'lib/*:system/lib/*:/usr/share/neo4j/lib/*' com.neo4j.tools.dump.DumpLogicalLog ./data/transactions/<Your Database Here>/neostore.transaction.db.0 /tmp/dumptxlog_1.log
----
Once dumped, you can search for a node ID, etc.
=== ./data/databases/graph.db/neostore.transaction.db.0[LogHeader{logFormatVersion=6, logVersion=0, lastCommittedTxId=1}] === Start[master=-1,me=-1,time=2019-01-29 00:14:49.524+0000/1548720889524,lastCommittedTxWhenTransactionStarted=1,additionalHeaderLength=8,[-75, 113, -36, 24, -49, -11, -31, -102],position=LogPosition{logVersion=0, byteOffset=16},checksum=-162089288840] Command[ -PropertyKey[0,no use,nameId=-1,propCount=0] +PropertyKey[0,in use,nameId=1,propCount=0,DynamicRecord[1,used=true,(4),type=-1,data=byte[99,111,100,101],start=true,next=-1]]] Commit[txId=2, 2019-01-29 00:14:49.543+0000/1548720889543] Start[master=-1,me=-1,time=2019-01-29 00:14:49.500+0000/1548720889500,lastCommittedTxWhenTransactionStarted=1,additionalHeaderLength=8,[-57, 79, -16, 29, 38, 48, 89, -74],position=LogPosition{logVersion=0, byteOffset=134},checksum=-160313975075] Command[ -Property[0,used=false,prev=-1,next=-1,node=0, (blocks not loaded)] +Property[0,used=true,prev=-1,next=-1,node=0,PropertyBlock[blocks=1,SHORT_STRING,key=0,value=A]]] Command[ -Node[0,used=false,rel=-1,prop=-1,labels=Inline(0x0:[]),light,secondaryUnitId=-1] +Node[0,used=true,rel=-1,prop=0,labels=Inline(0x0:[]),light,secondaryUnitId=-1]] ... Command[UpdateCounts[() + 1]] Commit[txId=10, 2019-01-29 00:31:04.302+0000/1548721864302] Start[master=-1,me=-1,time=2019-01-29 00:31:06.405+0000/1548721866405,lastCommittedTxWhenTransactionStarted=10,additionalHeaderLength=8,[77, -57, 58, -59, -5, 87, -51, -31],position=LogPosition{logVersion=0, byteOffset=1824},checksum=-161405968298] Command[ -Property[5,used=false,prev=-1,next=-1,node=5, (blocks not loaded)] +Property[5,used=true,prev=-1,next=-1,node=5,PropertyBlock[blocks=3,SHORT_STRING,key=0,value=CountMyTestString]]] Command[ -Node[5,used=false,rel=-1,prop=-1,labels=Inline(0x0:[]),light,secondaryUnitId=-1] +Node[5,used=true,rel=-1,prop=5,labels=Inline(0x0:[]),light,secondaryUnitId=-1]] Command[UpdateCounts[() + 1]] Commit[txId=11, 2019-01-29 00:31:06.406+0000/1548721866406] CheckPoint[position=LogPosition{logVersion=0, byteOffset=2041}]
此页面是否有帮助?