  We find a class of cylindrically symmetric, static electrovacuum spacetimes
generated by a non-homogeneous magnetic field and involving the cosmological
constant and one additional parameter, which determine uniquely the strength of
the magnetic field. We provide a simple model of a source producing the field.
