rsyslog パッケージの omfwd モジュールにより、TCP ベースの syslog 転送 [^1] が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が待たされる(最大で数分)。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。
- /var/log/messages
//現在時刻取得(yyyy/mm/dd hh:mm:ss) | |
function getCurrentTime() { | |
var now = new Date(); | |
var res = "" + now.getFullYear() + "/" + padZero(now.getMonth() + 1) + | |
"/" + padZero(now.getDate()) + " " + padZero(now.getHours()) + ":" + | |
padZero(now.getMinutes()) + ":" + padZero(now.getSeconds()); | |
return res; | |
} | |
//先頭ゼロ付加 |
#!/bin/bash -eu | |
# Docker環境構築(Amazon Linux 2用) | |
# locale | |
localectl set-locale LANG=ja_JP.UTF-8 | |
# timezone | |
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
rm -f /etc/localtime | |
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
#!/bin/bash -eu | |
# Docker環境構築(Amazon Linux 2023用) | |
# locale | |
localectl set-locale LANG=ja_JP.UTF-8 | |
# timezone | |
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
rm -f /etc/localtime | |
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import boto3 | |
import time | |
import logging | |
# Constants | |
LOG_GROUP_NAME = '/aws/lambda/test-filter-log-events' # Log group name of CloudWatch Logs | |
NUM_CHARS_TO_PRINT = 10 # Number of characters to print from log message | |
DELAY_OF_START_MS = 5000 # Initial delay before starting the log fetching process |
@WebFilter(urlPatterns = { "/*" }) | |
public class LoginFilter implements Filter { | |
private static final String URL_LOGIN = "/login/"; | |
private static final String[] URL_EXCLUDES = {URL_LOGIN, "/common/"}; | |
private static final String ATTR_LOGIN = "login"; | |
private static final String ATTR_ORIGIN_URL = "originUrl"; | |
@Override | |
public void doFilter(ServletRequest request, ServletResponse response, | |
FilterChain chain) throws IOException, ServletException { |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import socket | |
def send_broken_pipe(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(("localhost", 8082)) | |
request = "POST / HTTP/1.1\r\n" | |
request += "Content-Length: 123\r\n" | |
request += "\r\n" |
public String toUniqueName(String srcName, final List<String> existing) { | |
return toUniqueName(srcName, "", new NameChecker() { | |
@Override | |
public boolean exists(String name) { | |
return existing.contains(name); | |
} | |
}); | |
} | |
public File toUniqueFile(File file) { |
#!/usr/bin/env bash | |
for addr3 in $(seq 0 4); do | |
for addr4 in $(seq 1 255); do | |
ip addr add 172.32.${addr3}.${addr4}/16 dev eth0 | |
done | |
done |
#!/usr/bin/env python3 | |
import socket | |
import datetime | |
now = datetime.datetime.now().strftime('%b %d %H:%M:%S') | |
msg = '<34>%s testhost TestTCP: aaa111' % now | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('127.0.0.1', 514)) | |
sock.sendall(msg.encode('utf-8')) | |
sock.close() |