Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving Full Hash Values from Log Messages #27852

Closed
achakhalyan opened this issue Aug 4, 2023 · 7 comments
Closed

Retrieving Full Hash Values from Log Messages #27852

achakhalyan opened this issue Aug 4, 2023 · 7 comments

Comments

@achakhalyan
Copy link

Dear Geth Support Team,

I am working on a project that requires monitoring specific log entries related to rejected transactions in a Geth node. While analyzing the logs, I noticed that the hash values are truncated, and I am only able to retrieve a part of the hash (e.g., "e8cb6a..fc4198").

My current use case demands the full hash value for further processing and analysis. I have explored the available verbosity levels and other configurations but have not found a way to change the log format to include the complete hash values.

Here is an example log entry that I am working with:
TRACE[08-01|10:07:12.751] Possible uncle rejected hash=e8cb6a..fc4198 reason="ignore uncle for beacon block"

Could you please advise if there is an existing configuration option or method to include the full hash values in the log messages? If not, would it be possible to consider this as a feature request or provide guidance on how to achieve this requirement?

I appreciate your assistance and look forward to hearing from you. Please let me know if you need any additional information or context to assist with this inquiry.

Best regards,
Armen
[email protected]

@karalabe
Copy link
Member

karalabe commented Aug 4, 2023

The code for the log format is here: https://github.com/ethereum/go-ethereum/blob/master/common/types.go#L85

This pretty printing is only active for the "terminal" log format. You can log in other formats where this truncation will not happen, e.g. in logfmt format:

geth --log.format=logfmt

@karalabe karalabe closed this as completed Aug 4, 2023
@achakhalyan
Copy link
Author

not started node - flag provided but not defined: -log.format

@karalabe
Copy link
Member

karalabe commented Aug 4, 2023

Make sure you have a recent version of Geth

@achakhalyan
Copy link
Author

Geth
Version: 1.11.5-stable
Git Commit: a38f410
Architecture: amd64
Go Version: go1.20.2
Operating System: linux
geth --help

result for logs
`LOGGING AND DEBUGGING

--fakepow                      (default: false)
      Disables proof-of-work verification

--log.backtrace value
      Request a stack trace at a specific logging statement (e.g. "block.go:271")

--log.debug                    (default: false)
      Prepends log messages with call-site location (file and line number)

--log.file value
      Write logs to a file

--log.json                     (default: false)
      Format logs with JSON

--nocompaction                 (default: false)
      Disables db compaction after import

--pprof                        (default: false)
      Enable the pprof HTTP server

--pprof.addr value             (default: "127.0.0.1")
      pprof HTTP server listening interface

--pprof.blockprofilerate value (default: 0)
      Turn on block profiling with the given rate

--pprof.cpuprofile value
      Write CPU profile to the given file

--pprof.memprofilerate value   (default: 524288)
      Turn on memory profiling with the given rate

--pprof.port value             (default: 6060)
      pprof HTTP server listening port

--remotedb value
      URL for remote database

--trace value
      Write execution trace to the given file

--verbosity value              (default: 3)
      Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail

--vmodule value
      Per-module verbosity: comma-separated list of <pattern>=<level> (e.g.
      eth/*=5,p2p=4)

METRICS AND STATS`

@jsvisa
Copy link
Contributor

jsvisa commented Aug 4, 2023

@achakhalyan you need geth >= 1.11.6, as --log.logfmt is merged in #26970

@achakhalyan
Copy link
Author

oy ok its the latest update, thanks.

@jsvisa
Copy link
Contributor

jsvisa commented Aug 10, 2023

First of all, I'm not the Geth Support Team :), I'm just a member of the community and Gether.

when a transaction is rejected or replaced by

If you mean the tx in txpool by replaced, I think there will be no logs.
But if you mean a tx rejected by ChainReorg, AFAIK there will only be a log in block level. If you want to track the transaction rejected or replaced, I think you you can subscribe the NewPendingTransactions, ref https://geth.ethereum.org/docs/interacting-with-geth/rpc/pubsub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants