Have a Google account? your IP and web activity are kept forever
For those with a Google account (you have a Google account if you used Gmail, Picasa etc.) your IP and web activity are kept forever if you did not opt out of Web History. Not to be confused with Google's Search Engine terms and conditions, Web History is an "opt out" feature attached to the set up of a Google account e.g. Gmail such that if you did not opt out you are accepting Google's "Web History" terms and conditions, which are different than their Search Engine terms and conditions.
Web History Terms and Conditions
"What information do you collect when I use Web History?
In order to provide the service, Web History saves information about your web activity, including pages you visit and searches on Google. Over time, the service may use additional information about your activity on Google or other information you provide us in order to deliver a better search experience. The Web History Privacy Policy will be updated to inform you of any substantive changes to the service. Also, as stated in the main Google Privacy Policy, when you use any Google service, we collect additional information including your Internet Protocol address, browser type, browser language and one or more cookies that may uniquely identify your browser.
What happens when I pause the service, remove items, or delete the Web History service?
You can choose to stop storing your web activity in Web History either temporarily or permanently, or remove items, as described in Web History Help. If you remove items, they will be removed from the service and will not be used to improve your search experience. As is common practice in the industry, Google also maintains a separate logs system for auditing purposes and to help us improve the quality of our services for users. For example, we use this information to audit our ads systems, understand which features are most popular to users, improve the quality of our search results, and help us combat vulnerabilities such as denial of service attacks"
http://www.google.com/searchhistory/privacyfaq.html#edit
The following is an excerpt from Google's Search Engine terms and does not apply to the Web History service:
Search Engine Terms and Conditions
"Why are search engine logs kept before being anonymized?
We strike a reasonable balance between the competing pressures we face, such as the privacy of our users, the security of our systems and the need for innovation. We believe anonymizing IP addresses after 9 months and cookies in our search engine logs after 18 months strikes the right balance."
http://www.google.com/privacy_faq.html#toc-anonymize
Note for Chrome, Google Tool Bar etc there are yet more and different sets of terms and conditions, for example with Chrome each installation has a unique application (identification) number, which when combined with other Google services provides a significant amount of data about an individual user.
Tool Bar provides an even deeper analysis of a users online activity. Then there are new products such as Google Voice. Every voice mail, phone number etc. (even if you cancel your account) is permanently logged.