The importance of secondary instability of streaks for the generation of vortical structures attached to the wall in the logarithmic region of turbulent channels is studied. The streaks and their linear instability are computed by solving equations associated with the organized motion that include an eddy-viscosity modeling the effect of incoherent fluctuations. Three friction Reynolds numbers, Re-tau = 2000, 3000, and 5000, are investigated. For all flow cases, optimal streamwise vortices (i.e., having the highest potential for linear transient energy amplification) are used as initial conditions. Due to the lift-up mechanism, these optimal perturbations lead to the nonlinear growth of streaks. Based on a Floquet theory along the spanwise direction, we observe the onset of streak secondary instability for a wide range of spanwise wavelengths when the streak amplitude exceeds a critical value. Under neutral conditions, it is shown that streak instability modes have their energy mainly concentrated in the overlap layer and propagate with a phase velocity equal to the mean streamwise velocity of the log-layer. These neutral log-layer modes exhibit a sinuous pattern and have characteristic sizes that are proportional to the wall distance in both streamwise and spanwise directions, in agreement with the Townsend's attached eddy hypothesis (A. Townsend, the structure of turbulent shear flow, Cambridge university press, 1976 2nd edition). In particular, for a distance from the wall varying from y(+) approximate to 100 (in wall units) to y approximate to 0.3h, where h is half the height of the channel, the neutral log-layer modes are self-similar with a spanwise width of lambda(z) approximate to y/0.3 and a streamwise length of lambda(x) approximate to 3 lambda(z), independently of the Reynolds number. Based on this observation, it is suggested that compact vortical structures attached to the wall can be ascribed to streak secondary instabilities. In addition, spatial distributions of fluctuating vorticity components show that the onset of secondary instability is associated with the roll-up of the shear layer at the edge of the low-speed streak, similarly to a three-dimensional mixing layer. (C) 2015 AIP Publishing LLC.