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

Extract specific fields to put into database #229

Closed
wweiyang opened this issue May 3, 2018 · 3 comments
Closed

Extract specific fields to put into database #229

wweiyang opened this issue May 3, 2018 · 3 comments

Comments

@wweiyang
Copy link

wweiyang commented May 3, 2018

Hi,

I need to extract out certain fields from the requests/responses to put into a database.
For example if I want to have columns for "type", "method", "body" in the database and insert the respective fields from the logged requests/responses. Is that possible?

I was thinking of setting the values for these fields in a java object to be used for inserting the data to the database, but I first need a way to get these individual values from the logs. Or maybe there is another way of doing it?

@whiskeysierra
Copy link
Collaborator

You need to write a custom HttpLogWriter. The Precorrelation/Correlation parameters give you access to the original request/response from where you can derive stuff like type, method and body. If you completely ignore the formatted string (produced by a HttpLogFormatter) then you may implement a special one that just returns an empty string so you don't waste time producing a string that you don't need in the end.

@wweiyang
Copy link
Author

wweiyang commented May 9, 2018

May I know the difference between HttpLogWriter and HttpLogFormatter? What does each one do? And which one gets called first? Just want to get a clearer picture of how they work.

@whiskeysierra And regarding your previous reply, I've managed to access the individual fields through HttpLogWriter, thanks for the help on that part. 👍

@whiskeysierra
Copy link
Collaborator

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

No branches or pull requests

2 participants