How to measure small, spiky amounts of current?
Well, there's certainly specific current-sensing ICs. In your case, I'd "simply" go with something like: 


Use a small (e.g. 0.5 Ω) series resistor between battery and your electronics.
Amplify the voltage across that resistor with an instrumentation amplifier
Log that voltage, e.g. using an ADC


Problems:


low currents · low resistance = low voltage: Your measurement accuracy will be bad due to noise
since microcontrollers wake up very fast and go to sleep equally fast, your ADC sampling rate necessarily needs to be very high.


But as a principle, that works, and is certainly viable (although designing a stable, low-noise, high-amplification instrumentation amplifier might be nontrivial; but: there's existing instr.amp ICs that make that a lot easier).

Luckily, your problem is rather common. So: Many, including Texas Instruments, have a portfolio of current sensing amplifiers, some of which integrate both aforementioned shunt resistor AND a digital interface. See TI's product listing. 

In fact, these ICs are capable of measuring current and supply voltage at the same time – and that's great to actually measure drawn power, a measure far more relevant to battery life than raw drawn current, if there's nonlinear elements (that is, for example, MCUs). 

The INA233, for example, can be connected to an external shunt (let's say, 0.3 Ω) and has a resolution of 2.5 µV per ADC step. That means, a single ADC step is I = U/R = 2.5 µV / 0.3 Ω = 8.333 µA in current. 

I think that device also has an automatic sampling &amp; averaging mode, so that you can easily get good approximations even under rapidly changing load.

Also, as I just found out: the thing has an "alert" level, so that you can wake up your measurement system whenever the current rises above a configurable threshold. Nice! That way, you only need to sample occasionally.