The Internet of Things (IoT) paradigm has revolutionized several industries (e.g. manufacturing, health, transport, education, etc.) by allowing objects to get connected to the Internet and thus enabling a variety of novel applications. In this sense, IoT devices became an essential component of smart cities, enabling lots of novel and useful services but, at the same time, bringing along numerous cybersecurity threats. The paper at hand proposes blocksiem, a blockchain-based and distributed Security Information and Event Management (SIEM) solution framework for the protection of such smart city services. The proposed SIEM relies on the blockchain technology to securely store and access security events. Such security events are generated by IoT sentinels that in turn are in charge of shielding groups of IoT devices. The IoT sentinels may be deployed in smart city scenarios like smart hospitals, smart transportation systems, smart airports, etc., ensuring a satisfying level of protection. Thanks to its features, the blockchain guarantees the non-repudiation and traceability of the registry of security events. To demonstrate the feasibility of the proposed approach, our proposal is implemented using Ethereum and validated through different use cases and experiments.