sourceCategory for multiple AWS Lambda Applications



  • Avatar
    Himanshu Pal

    Currently in our lambda functions

    sourceName is mapped to logStream
    sourceHost is mapped to logGroup 
    and there is single sourceCategory.

    One way is to use these fields to build your dashboards but I am assuming you want to have your own custom organization  <DEPT>/App2/Prod

    If one wants to have multiple sourceCategories then there are two ways of doing it both involve changing function's code

    I am using you can create <DEPT>/App2/Prod string using the messages and context information present in lambda environment.

    Our functions use a common utils library sumo-dlq-function-utils which exports SumoLogsClient object.
    1> Before passing it to SumoLogsClient you can add _metadata along with the message with category = <DEPT>/App2/Prod
    2> You can directly modify the common library's code by going to generateHeaders function in sumologsclient.js  and changing the sourcecategory there.

    Both these methods works because Sumo Logic supports passing source categories, source name and source host in request header in following way X-Sumo-Name:sourceName, X-Sumo-Category:sourceCategory,

  • Avatar
    Himanshu Pal

    There is also another way of doing this without changing the lambda code. One can use FER to overwrite _sourceCategory

Please sign in to leave a comment.