@Takeshi Sakaguchi
Thank you for your post and I apologize for the delayed response!
I understand that you plan to pull all of your user's Sign-in logs within Azure Active Directory but noticed that if you have an Azure Active Directory P1 or P2 license, you can access the sign-in activity report through the Microsoft Graph API.
When it comes to your specific question of how many licenses need to be purchased to access the sign-in logs from the Microsoft Graph API. From my understanding and referencing the Apply Licenses to Users documentation - Anyone who has a business need to use a licensed Azure AD service must have the required licenses...
Because the sign-in activity report is available in all editions of Azure AD - if your user is the only one required access to the Microsoft Graph API to get the sign-in activity report, you should only need one Azure AD P1 license assigned directly to your user.
Note: In a scenario where all your users are required to leverage a licensed feature for example Conditional Access Policies, you'll need the correct number of licenses per user.
Additional Links:
I hope this helps!
If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.
If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.