The IRS fends off 4 million hacking attempts a day, Commissioner John Koskinen said Tuesday, saying the tax agency does a solid job of keeping intruders out of its databases, though hackers have managed to spoof some taxpayers and steal their information individually.

Mr. Koskinen begged for more money and talked about his repeated battles with Congress as he prepares to leave the IRS on Nov. 12, when his term ends.

Speaking to the Tax Policy Center, the commissioner said the agency is down tens of thousands of employees and has fallen behind on its budget, blamed Congress for not allocating more resources, but praised IRS employees for slogging through.

He also pointedly recalled efforts to impeach him for his handling of the tea party targeting scandal, which he was hired to clean up.

Mr. Koskinen did not, however, apologize to tea party groups for the targeting -- though Attorney General Jeff Sessions last week said the IRS owes the groups a mea culpa.

He did praise the workers responsible for the targeting, saying that when he visited with them in 2014 for a town hall, he found them "energetic and dedicated to the mission."

And Mr. Koskinen took a swipe at his agency's inspector general, J. Russell George, who exposed the tea party targeting -- while admitting Mr. George's work is valuable.

"Sometimes they get a little carried away with their reports, but they're important reports to have," the commissioner said of the inspector general.

As for hacking, he said the IRS maintains the world's "greatest database" and it would be the goal of any serious hacker. He said so far they've been able to deter any breach.

"They have not been able to get into the system," he said.

More than 100,000 taxpayers did have their tax files stolen several years ago, on Mr. Koskinen's watch, after hackers were able to impersonate individual taxpayers, accessing their full tax transcripts.

The IRS had to suspend that online function to head off more breaches.

Mr. Koskinen, speaking at an event hosted by the Tax Policy Center, said there are 277 "touch points" where taxpayers can access information on IRS systems, and his agency has to be on top of all of those entry points.

He said they do their best, but can't keep up with all of the security changes to the agency's systems.

"We have such a huge system we have thousands of patches showing up every day and it's a prioritization system. We can't do them all because we don't have the resources," he said.