S3
Arkime capture can save PCAP to S3 or an S3 compatible server instead of local disk. The expected use case is a lower volume capture process on each cloud instance writing to S3, instead of a central Arkime sensor writing to local disk. Since the PCAP lives in S3, you don’t need to run viewer on each capture node, and capture instances can come and go without losing PCAP. For bucket security, the capture nodes only need permission to write objects.
All writing from capture to S3 uses TLS (the HTTPS S3 REST endpoint). To have the PCAP encrypted at rest, configure the bucket’s default encryption.
See Writer S3 Settings for all the options, including the storage class, compression and connection limits.
- PCAP is compressed with zstd by default before it is uploaded, see s3Compression
- The S3 writer uses the S3 Multipart Upload API, and each part is pcapWriteSize bytes, with a minimum of 5MB
- Each PCAP file is closed once it reaches maxFileSizeG, with S3’s limit of 10,000 parts per object also capping the file size
- S3 doesn’t allow downloading an object until it is completely uploaded, so set maxFileTimeM to a low value if you want to view recent PCAP
- To get debug logs from the S3 writer, start capture with the
-doption - To use an S3 compatible server, such as MinIO or Ceph, set s3Host and usually s3PathAccessStyle=true
Capture can also read PCAP that is already in S3, see Reader Scheme S3.
Credentials
Use an IAM role when you can, such as an EC2 instance profile, EKS IRSA or EKS Pod Identity, instead of putting access keys in config.ini. Only use s3AccessKeyId and s3SecretAccessKey when the machine isn’t running in AWS. The Writer S3 Settings section lists the order Arkime looks for credentials, which changed in 7.0.
Sample Installation and Configuration
These instructions assume one AWS account writes into the bucket, with separate permissions for capture and viewer. If you will be writing to a central bucket from many AWS accounts or VPCs, you will need a bucket policy as well.
- Create an S3 bucket
example-arkime-pcap - Create an IAM policy
ArkimeCapturePolicy- See the AWS docs for Multipart Upload API and permissions for more information
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::example-arkime-pcap/*"
]
}
]
}
- Create an IAM policy
ArkimeViewerPolicy- Viewer deletes PCAP older than s3ExpireDays, so it needs the
s3:DeleteObjectaction
- Viewer deletes PCAP older than s3ExpireDays, so it needs the
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::example-arkime-pcap/*"
]
}
]
}
- Create IAM roles, or users if not running in AWS, and attach the policies
ArkimeCapture- used on capture nodes, attachArkimeCapturePolicyArkimeViewer- used on viewer nodes, attachArkimeViewerPolicy
- On the capture nodes you’ll want a config file with the following settings
plugins=writer-s3.so;#OTHER PLUGINS
pcapWriteMethod=s3
s3Region=us-east-1
s3Bucket=example-arkime-pcap
- On the viewer node you’ll need the following settings. This can be a central viewer node, viewer doesn’t need to run on the capture nodes.
- The s3ExpireDays setting expires PCAP for every node in the cluster, so it only needs to be set on one viewer
pcapWriteMethod=s3
viewerPlugins=writer-s3
s3ExpireDays=10
Expiring PCAP with s3ExpireDays also removes the matching files entries from OpenSearch/Elasticsearch. If you use an S3 lifecycle rule instead, sessions will still point at PCAP that no longer exists.