How to keep log of API calls

Hi,

I would really appreciate if somebody share their thoughts about how to keeping log of API calls,

What should i prefer keep log in DB which may not work properly when log increases?

OR file write, if so what structure should i keep to log API calls, so that i could search in to the logs in easier way to find the errors occurred for some user?.

Thanks for your reply, i will look in to more regarding this

If it’s only errors you’ll be interested in, I wouldn’t store all the info but use error and exception handling to only log errors (got PHP?).

I’m no Database Design guru and only now getting away from the “one big table with everything” mentality, so I’m not much help with that I’m afraid. Though if you post a thread in DataBase or MySQL (depending on what you’re working with) I’m sure someone more knowledgeable than myself will help. Better than me guessing at it.

I do understand that keeping log in DB gives us more control and better option to retrieve details. How should we manage details, if so many API calls are made,
how should i structure the DB. Could you give me more input?

I prefer to keep details like
1.Function Name
2. Parameters,
3. Response status,
4. User who made API call
5. Time
6. Response Text

Is anything else should i consider, let me know your suggestions.

So by keeping above details, i could track the errors or if some users API call doesn’t work properly i could look into the parameters send through the API call and could locate if the problem exists with parameters or not.

What makes you think the database will fail? In my limited experience I’ve often been amazed that they handle whatever’s thrown at them.

That said, what do you plan on doing with the information? Just reading it, or manipulating (portions of?) it? How often, and how long to you plan on retaining the data?