Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
- Create an AWS account with permissions to create and manage S3 buckets, Lambda functions, and IAM roles. For more information, see the AWS documentation.
Package the requests module
Before creating the Lambda function, package the requests module so it can be used in the function:- Create a new directory.
- Install the requests module into the current directory using pip.
- Zip the contents of the directory.
- Add your Lambda function file to the zip file.
Create AWS Lambda function
Create a Lambda function with Python runtime and upload the packaged zip file containing the requests module and your function code below:DATASET_NAME
is the name of the Axiom dataset where you want to send data.AXIOM_DOMAIN
is the Axiom domain that your organization uses. For more information, see Regions.API_TOKEN
is the Axiom API token you have generated. For added security, store the API token in an environment variable.
Understanding log format
The.log
extension doesn’t guarantee any specific format. Log files might contain:
- JSON (single object or array)
- NDJSON/JSONL (one JSON object per line)
- Syslog format
- XML
- Application-specific formats (Apache, Nginx, ELB, etc.)
- Custom formats with quoted strings and special characters