https://github.com/maki-daisuke/squid-strftimer
Replace Sqiud-style timestamp with using strftimer format
https://github.com/maki-daisuke/squid-strftimer
log squid
Last synced: about 1 year ago
JSON representation
Replace Sqiud-style timestamp with using strftimer format
- Host: GitHub
- URL: https://github.com/maki-daisuke/squid-strftimer
- Owner: Maki-Daisuke
- License: mit
- Created: 2019-09-11T02:35:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T21:45:06.000Z (over 6 years ago)
- Last Synced: 2025-04-02T00:52:10.464Z (over 1 year ago)
- Topics: log, squid
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Squid-strftimer
===============
A TCP daemon receiving Squid logs, replacing timestamps in the logs using `strftime` format
(cf. replacing `1568175398.603` with `2019-09-11T04:16:38.603000Z`), and then writing the result
to a file or STDOUT
How to Install
--------------
```
$ got get github.com/Maki-Daisuke/squid-strftimer
```
How to Use
----------
Start squid-strftimer daemon:
```
$ squid-strftimer &
```
Add the following line in your `squid.conf`:
```
access_log tcp://localhost:36059 squid
```
Restart Squid server. Then, Squid start to send access log to squid-strftimer daemon.
Use with Docker & AWS CloudWatch Logs
-------------------------------------
You can easily send access logs to AWS CloudWatch Logs with using Docker.
For example, you can write docker-compose.yml like this:
```
# docker-compose.yml
version: "3.7"
services:
logdaemon:
build:
image: squid-strftimer
logging:
driver: awslogs
options:
awslogs-region: ap-northeast-1
awslogs-group: access.log
awslogs-stream: mystream
awslogs-datetime-format: "%Y-%m-%dT%H:%M:%S.%fZ"
squid:
image: sameersbn/squid:3.5.27
volumes:
- type: bind
source: ./squid.conf
target: /etc/squid/squid.conf
```
And, add the following line in your squid.conf:
```
access_log tcp://logdaemon:36059 squid
```
You need to configure AWS credentials.
See [docker docs](https://docs.docker.com/config/containers/logging/awslogs/) for more details.
Command-Line Options
--------------------
```
Usage: squid-strftimer [-h] [--format FORMAT] [--port PORT] [FILE]
```
- `FORMAT`
- Strftime-style format
- default: `"%Y-%m-%dT%H:%M:%S.%fZ"`
- `PORT`
- TCP port to listen
- default: `36059`
- `FILE`
- File to output logs
- Use STDOUT if `"-"` is specified
- default: `"-"`
License
-------
MIT License
Author
------
Daisuke (yet another) Maki