![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
github.com/Diwamoto/alb-log-parser
A Go library for parsing AWS Application Load Balancer (ALB) access logs. This library provides a simple and efficient way to parse ALB log entries into structured data.
go get github.com/Diwamoto/alb-log-parser
Here's a simple example of how to use the library:
package main
import (
"fmt"
"compress/gzip"
"os"
"bufio"
albparser "github.com/Diwamoto/alb-log-parser"
)
func main() {
// Create a new parser instance
parser := albparser.NewAlbLogParser()
// Open gzipped ALB log file
// ALB logs are often in gz format when fetched from S3.
f, err := os.Open("alb-logs.gz")
if err != nil {
fmt.Printf("Error opening file: %v\n", err)
return
}
defer f.Close()
// Create gzip reader
gz, err := gzip.NewReader(f)
if err != nil {
fmt.Printf("Error creating gzip reader: %v\n", err)
return
}
defer gz.Close()
// Read line by line
scanner := bufio.NewScanner(gz)
for scanner.Scan() {
record, err := parser.ParseAlbLog(scanner.Text())
if err != nil {
fmt.Printf("Error parsing log: %v\n", err)
continue
}
// Access the parsed fields
fmt.Printf("Request Method: %s\n", record.HttpMethod)
fmt.Printf("Status Code: %s\n", record.ElbStatusCode)
fmt.Printf("Client IP: %s\n", record.ClientIP)
}
if err := scanner.Err(); err != nil {
fmt.Printf("Error reading file: %v\n", err)
}
}
others
package main
import (
"fmt"
albparser "github.com/Diwamoto/alb-log-parser"
)
func main() {
// Create a new parser instance
parser := albparser.NewAlbLogParser()
// Example ALB log line
logLine := `http 2024-01-01T12:00:00.000000Z app/my-loadbalancer/1234567890 172.16.1.1:1234 10.0.1.1:80 0.001 0.002 0.003 200 200 123 456 "GET https://example.com/ HTTP/1.1" ...`
// Parse the log line
record, err := parser.ParseAlbLog(logLine)
if err != nil {
fmt.Printf("Error parsing log: %v\n", err)
return
}
// Access the parsed fields
fmt.Printf("Request Method: %s\n", record.HttpMethod)
fmt.Printf("Status Code: %s\n", record.ElbStatusCode)
fmt.Printf("Client IP: %s\n", record.ClientIP)
}
The parser extracts all fields from ALB access logs.
For a complete list of supported fields, see the AWS documentation.
Contributions are welcome! Please feel free to submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
Diwamoto (@Diwamoto)
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.